src/Stream/Util.php
public static function toString(StreamInterface $stream)
    {
        if (!$stream->isReadable()) {
            return '';
        }

        if ($stream->isSeekable()) {
            $pos     = $stream->tell();
            $content = $stream->__toString();

            $stream->seek($pos);
        } else {
            $content = $stream->__toString();
        }

        return $content;
    }
public static function toString(StreamInterface $stream)
    {
        if (!$stream->isReadable()) {
            return '';
        }

        if ($stream->isSeekable()) {
            $pos     = $stream->tell();
            $content = $stream->__toString();

            $stream->seek($pos);
        } else {
            $content = $stream->__toString();
        }

        return $content;
    }
public static function toString ( StreamInterface $ stream ) { if ( ! $ stream -> isReadable ( ) ) { return '' ; } if ( $ stream -> isSeekable ( ) ) { $ pos = $ stream -> tell ( ) ; $ content = $ stream -> __toString ( ) ; $ stream -> seek ( $ pos ) ; } else { $ content = $ stream -> __toString ( ) ; } return $ content ; }
Converts an stream into an string and returns the result. The position of
the pointer will not change if the stream is seekable. Note this copies
the complete content of the stream into the memory

@param \Psr\Http\Message\StreamInterface $stream
@return string
Converts an stream into an string and returns the result . The position of the pointer will not change if the stream is seekable . Note this copies the complete content of the stream into the memory