Scalr\Service\Aws\S3\V20060301\S3Api::deleteBucket PHP Method

deleteBucket() public method

This implementation of the DELETE operation deletes the bucket named in the URI. All objects (including all object versions and Delete Markers) in the bucket must be deleted before the bucket itself can be deleted.
public deleteBucket ( string $bucketName ) : boolean
$bucketName string A bucket name.
return boolean Returns true on success or throws an exception.
    public function deleteBucket($bucketName)
    {
        $result = false;
        $options = array('_subdomain' => (string) $bucketName);
        $response = $this->client->call('DELETE', $options, '/');
        if ($response->getError() === false) {
            $result = true;
            $bucket = $this->s3->bucket->get((string) $bucketName);
            if ($bucket instanceof BucketData) {
                $this->getEntityManager()->detach($bucket);
            }
        }
        return $result;
    }