You are here

public function PhpInputStream::getContents in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/PhpInputStream.php \Zend\Diactoros\PhpInputStream::getContents()

Returns the remaining contents in a string

Return value

string

Throws

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

Overrides Stream::getContents

1 call to PhpInputStream::getContents()
PhpInputStream::__toString in vendor/zendframework/zend-diactoros/src/PhpInputStream.php
Reads all data from the stream into a string, from the beginning to end.

File

vendor/zendframework/zend-diactoros/src/PhpInputStream.php, line 78

Class

PhpInputStream
Caching version of php://input

Namespace

Zend\Diactoros

Code

public function getContents($maxLength = -1) {
  if ($this->reachedEof) {
    return $this->cache;
  }
  $contents = stream_get_contents($this->resource, $maxLength);
  $this->cache .= $contents;
  if ($maxLength === -1 || $this
    ->eof()) {
    $this->reachedEof = true;
  }
  return $contents;
}