public function Stream::__toString

Convert the stream to a string if the stream is readable and the stream is seekable.

Return value

string

Overrides StreamInterface::__toString

File

drupal/core/vendor/guzzle/stream/Guzzle/Stream/Stream.php, line 76

Class

Stream
PHP stream implementation

Namespace

Guzzle\Stream

Code

public function __toString() {
  if (!$this
    ->isReadable() || !$this
    ->isSeekable() && $this
    ->isConsumed()) {
    return '';
  }
  $originalPos = $this
    ->ftell();
  $body = stream_get_contents($this->stream, -1, 0);
  $this
    ->seek($originalPos);
  return $body;
}