You are here

public function AppendStream::__toString in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/psr7/src/AppendStream.php \GuzzleHttp\Psr7\AppendStream::__toString()

Reads all data from the stream into a string, from the beginning to end.

This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.

Warning: This could attempt to load a large amount of data into memory.

This method MUST NOT raise an exception in order to conform with PHP's string casting operations.

Return value

string

Overrides StreamInterface::__toString

See also

http://php.net/manual/en/language.oop5.magic.php#object.tostring

File

vendor/guzzlehttp/psr7/src/AppendStream.php, line 32

Class

AppendStream
Reads from multiple streams, one after the other.

Namespace

GuzzleHttp\Psr7

Code

public function __toString() {
  try {
    $this
      ->rewind();
    return $this
      ->getContents();
  } catch (\Exception $e) {
    return '';
  }
}