putObject($input, $bucket, $uri); // Tentatively accept that this method succeeded. $result = true; // Should I download the file and compare its contents with my random data? if (self::$downloadAfter) { $downloadedData = $s3->getObject($bucket, $uri); $result = self::areStringsEqual($sourceData, $downloadedData); } // Should I delete the remotely stored file? if (self::$deleteRemote) { // Delete the remote file. Throws exception if it fails. $s3->deleteObject($bucket, $uri); } return $result; } }