You are here

public function StreamDecoratorTrait::__get in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php \GuzzleHttp\Psr7\StreamDecoratorTrait::__get()

Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).

Parameters

string $name Name of the property (allows "stream" only).:

Return value

StreamInterface

File

vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php, line 28

Class

StreamDecoratorTrait
Stream decorator trait @property StreamInterface stream

Namespace

GuzzleHttp\Psr7

Code

public function __get($name) {
  if ($name == 'stream') {
    $this->stream = $this
      ->createStream();
    return $this->stream;
  }
  throw new \UnexpectedValueException("{$name} not found on class");
}