src/Response/Serializer.php
public static function fromStream(StreamInterface $stream)
    {
        if (! $stream->isReadable() || ! $stream->isSeekable()) {
            throw new InvalidArgumentException('Message stream must be both readable and seekable');
        }

        $stream->rewind();

        list($version, $status, $reasonPhrase) = self::getStatusLine($stream);
        list($headers, $body)                  = self::splitStream($stream);

        return (new Response($body, $status, $headers))
            ->withProtocolVersion($version)
            ->withStatus($status, $reasonPhrase);
    }
public static function fromStream(StreamInterface $stream)
    {
        if (! $stream->isReadable() || ! $stream->isSeekable()) {
            throw new InvalidArgumentException('Message stream must be both readable and seekable');
        }

        $stream->rewind();

        list($version, $status, $reasonPhrase) = self::getStatusLine($stream);
        list($headers, $body)                  = self::splitStream($stream);

        return (new Response($body, $status, $headers))
            ->withProtocolVersion($version)
            ->withStatus($status, $reasonPhrase);
    }
public static function fromStream ( StreamInterface $ stream ) { if ( ! $ stream -> isReadable ( ) || ! $ stream -> isSeekable ( ) ) { throw new InvalidArgumentException ( 'Message stream must be both readable and seekable' ) ; } $ stream -> rewind ( ) ; list ( $ version , $ status , $ reasonPhrase ) = self :: getStatusLine ( $ stream ) ; list ( $ headers , $ body ) = self :: splitStream ( $ stream ) ; return ( new Response ( $ body , $ status , $ headers ) ) -> withProtocolVersion ( $ version ) -> withStatus ( $ status , $ reasonPhrase ) ; }
Parse a response from a stream.

@param StreamInterface $stream
@return ResponseInterface
@throws InvalidArgumentException when the stream is not readable.
@throws UnexpectedValueException when errors occur parsing the message.
Parse a response from a stream .