You are here

public function PhpInputStream::__toString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/PhpInputStream.php \Zend\Diactoros\PhpInputStream::__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 Stream::__toString

See also

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

File

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

Class

PhpInputStream
Caching version of php://input

Namespace

Zend\Diactoros

Code

public function __toString() {
  if ($this->reachedEof) {
    return $this->cache;
  }
  $this
    ->getContents();
  return $this->cache;
}