Google\Cloud\Storage\Bucket::object PHP Method

object() public method

Example: $object = $bucket->object('file.txt');
public object ( string $name, array $options = [] ) : StorageObject
$name string The name of the object to request.
$options array [optional] { Configuration options. @type string $generation Request a specific revision of the object. @type string $encryptionKey A base64 encoded AES-256 customer-supplied encryption key. It will be neccesary to provide this when a key was used during the object's creation. @type string $encryptionKeySHA256 Base64 encoded SHA256 hash of the customer-supplied encryption key. This value will be calculated from the `encryptionKey` on your behalf if not provided, but for best performance it is recommended to pass in a cached version of the already calculated SHA. }
return StorageObject
    public function object($name, array $options = [])
    {
        $generation = isset($options['generation']) ? $options['generation'] : null;
        $encryptionKey = isset($options['encryptionKey']) ? $options['encryptionKey'] : null;
        $encryptionKeySHA256 = isset($options['encryptionKeySHA256']) ? $options['encryptionKeySHA256'] : null;
        return new StorageObject($this->connection, $name, $this->identity['bucket'], $generation, null, $encryptionKey, $encryptionKeySHA256);
    }

Usage Example

Beispiel #1
0
 public function testInstantiateObjectWithGeneration()
 {
     $bucket = new Bucket($this->connection->reveal(), 'bucket');
     $object = $bucket->object('peter-venkman.jpg', ['generation' => '5']);
     $this->assertInstanceOf('Google\\Cloud\\Storage\\StorageObject', $object);
 }
All Usage Examples Of Google\Cloud\Storage\Bucket::object