Convert the stream to a string if the stream is readable and the stream is seekable.
string
Overrides StreamInterface::__toString
public function __toString() {
if (!$this
->isReadable() || !$this
->isSeekable() && $this
->isConsumed()) {
return '';
}
$originalPos = $this
->ftell();
$body = stream_get_contents($this->stream, -1, 0);
$this
->seek($originalPos);
return $body;
}