Webiny\Component\Amazon\S3::doesBucketExist PHP Метод

doesBucketExist() публичный Метод

Determines whether or not a bucket exists by name
public doesBucketExist ( string $bucket, boolean $accept403 = true, array $params = [] ) : boolean
$bucket string The name of the bucket
$accept403 boolean Set to true if 403s are acceptable
$params array Additional options to add to the executed command
Результат boolean
    public function doesBucketExist($bucket, $accept403 = true, array $params = [])
    {
        return $this->instance->doesBucketExist($bucket, $accept403, $params);
    }

Usage Example

Пример #1
0
 /**
  * @dataProvider driverSet
  */
 public function testAmazon(S3 $S3)
 {
     $S3->createBucket($this->bucket);
     $this->assertTrue($S3->doesBucketExist($this->bucket));
     $S3->putObject($this->bucket, $this->key, 'Component test');
     $this->assertTrue($S3->doesObjectExist($this->bucket, $this->key));
     $this->assertSame('Component test', (string) $S3->getObject($this->bucket, $this->key)['Body']);
     $S3->deleteObject($this->bucket, $this->key);
     $this->assertFalse($S3->doesObjectExist($this->bucket, $this->key));
     $S3->deleteBucket($this->bucket);
     $this->assertFalse($S3->doesBucketExist($this->bucket));
 }