Gaufrette\Adapter\AwsS3::read PHP Method

read() public method

public read ( $key )
    public function read($key)
    {
        $this->ensureBucketExists();
        $options = $this->getOptions($key);
        try {
            return (string) $this->service->getObject($options)->get('Body');
        } catch (\Exception $e) {
            return false;
        }
    }

Usage Example

 /**
  * @expectedException \RuntimeException
  */
 public function testThrowsExceptionIfBucketMissingAndNotCreating()
 {
     $mock = new MockPlugin(array(new Response(404)));
     $client = $this->getClient();
     $client->addSubscriber($mock);
     $adapter = new AwsS3($client, 'bucket');
     $adapter->read('foo');
 }