You are here

public function Stream::getContents in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/Stream.php \Zend\Diactoros\Stream::getContents()
  2. 8 vendor/guzzlehttp/psr7/src/Stream.php \GuzzleHttp\Psr7\Stream::getContents()
  3. 8 vendor/symfony/psr-http-message-bridge/Tests/Fixtures/Stream.php \Symfony\Bridge\PsrHttpMessage\Tests\Fixtures\Stream::getContents()
Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/Stream.php \GuzzleHttp\Psr7\Stream::getContents()

Returns the remaining contents in a string

Return value

string

Throws

\RuntimeException if unable to read or an error occurs while reading.

Overrides StreamInterface::getContents

File

vendor/guzzlehttp/psr7/src/Stream.php, line 100

Class

Stream
PHP stream implementation.

Namespace

GuzzleHttp\Psr7

Code

public function getContents() {
  $contents = stream_get_contents($this->stream);
  if ($contents === false) {
    throw new \RuntimeException('Unable to read stream contents');
  }
  return $contents;
}