src/BaiduBce/Services/Bos/BosClient.php
public function doesBucketExist($bucketName, $options = array())
    {
        list($config) = $this->parseOptions($options, BosOptions::CONFIG);

        try {
            $this->sendRequest(
                HttpMethod::HEAD,
                array(
                    BosOptions::CONFIG => $config,
                    'bucket_name' => $bucketName
                )
            );
            return true;
        } catch (BceServiceException $e) {
            if ($e->getStatusCode() === 403) {
                return true;
            }
            if ($e->getStatusCode() === 404) {
                return false;
            }
            throw $e;
        }
    }
public function doesBucketExist($bucketName, $options = array())
    {
        list($config) = $this->parseOptions($options, BosOptions::CONFIG);

        try {
            $this->sendRequest(
                HttpMethod::HEAD,
                array(
                    BosOptions::CONFIG => $config,
                    'bucket_name' => $bucketName
                )
            );
            return true;
        } catch (BceServiceException $e) {
            if ($e->getStatusCode() === 403) {
                return true;
            }
            if ($e->getStatusCode() === 404) {
                return false;
            }
            throw $e;
        }
    }
public function doesBucketExist ( $ bucketName , $ options = array ( ) ) { list ( $ config ) = $ this -> parseOptions ( $ options , BosOptions :: CONFIG ) ; try { $ this -> sendRequest ( HttpMethod :: HEAD , array ( BosOptions :: CONFIG => $ config , 'bucket_name' => $ bucketName ) ) ; return true ; } catch ( BceServiceException $ e ) { if ( $ e -> getStatusCode ( ) === 403 ) { return true ; } if ( $ e -> getStatusCode ( ) === 404 ) { return false ; } throw $ e ; } }
Check whether there is some user access to this bucket.

@param string $bucketName The bucket name.
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating BosClient instance.
@return boolean true means the bucket does exists.
Check whether there is some user access to this bucket .