public static function Serializer::fromStream in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/zendframework/zend-diactoros/src/Request/Serializer.php \Zend\Diactoros\Request\Serializer::fromStream()
- 8.0 vendor/zendframework/zend-diactoros/src/Response/Serializer.php \Zend\Diactoros\Response\Serializer::fromStream()
Same name and namespace in other branches
- 8 vendor/zendframework/zend-diactoros/src/Response/Serializer.php \Zend\Diactoros\Response\Serializer::fromStream()
Parse a response from a stream.
Parameters
StreamInterface $stream:
Return value
Throws
InvalidArgumentException when the stream is not readable.
UnexpectedValueException when errors occur parsing the message.
1 call to Serializer::fromStream()
- Serializer::fromString in vendor/
zendframework/ zend-diactoros/ src/ Response/ Serializer.php - Deserialize a response string to a response instance.
File
- vendor/
zendframework/ zend-diactoros/ src/ Response/ Serializer.php, line 44
Class
Namespace
Zend\Diactoros\ResponseCode
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);
}