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

Get object identified by bucket and key
public getObject ( string $bucket, string $key, array $params = [] ) : mixed
$bucket string
$key string
$params array
Результат mixed
Пример #1
0
 /**
  * @inheritdoc
  */
 public function getContents($key)
 {
     $this->recentKey = $key;
     try {
         $data = (string) $this->s3Client->getObject($this->bucket, $key)['Body'];
     } catch (NoSuchKeyException $e) {
         throw new StorageException(StorageException::FAILED_TO_READ);
     }
     return $data;
 }
Пример #2
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));
 }