You are here

public function PhpInputStream::read in Zircon Profile 8.0

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

Read data from the stream.

Parameters

int $length Read up to $length bytes from the object and return: them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes.

Return value

string Returns the data read from the stream, or an empty string if no bytes are available.

Throws

\RuntimeException if an error occurs.

Overrides Stream::read

File

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

Class

PhpInputStream
Caching version of php://input

Namespace

Zend\Diactoros

Code

public function read($length) {
  $content = parent::read($length);
  if ($content && !$this->reachedEof) {
    $this->cache .= $content;
  }
  if ($this
    ->eof()) {
    $this->reachedEof = true;
  }
  return $content;
}