You are here

public function Stream::getContents in Lockr 7.3

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 91

Class

Stream
PHP stream implementation.

Namespace

GuzzleHttp\Psr7

Code

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