A class only reading the metadata URL with an appropriate header.

This class makes it easy to test the MetadataStream class.

CloneableInstantiable
ImplementsGoogle\Cloud\Core\Compute\Metadata\Readers\ReaderInterface
Constants
public Google\Cloud\Core\Compute\Metadata\Readers\StreamReader::BASE_URL = 'http://169.254.169.254/computeMetadata/v1/'
 

The base PATH for the metadata.

  • deprecated
public Google\Cloud\Core\Compute\Metadata\Readers\StreamReader::FLAVOR_HEADER = 'Metadata-Flavor: Google'
 

The header whose presence indicates GCE presence.

  • deprecated
Methods
public __construct()
 

We create the common context in the constructor.

public read( $path)
 

Read the metadata for a given path.

  • return string
Methods
protected createStreamContext(array $options)
 

Abstracted for testing.

  • return resource
  • codeCoverageIgnore
protected getMetadata( $url)
 

Abstracted for testing.

  • return string
  • codeCoverageIgnore
Properties
private $context
 

A common context for this reader.

© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only