private static function Serializer::getStatusLine in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/Response/Serializer.php \Zend\Diactoros\Response\Serializer::getStatusLine()
Retrieve the status line for the message.
Parameters
StreamInterface $stream:
Return value
array Array with three elements: 0 => version, 1 => status, 2 => reason
Throws
UnexpectedValueException if line is malformed
1 call to Serializer::getStatusLine()
- Serializer::fromStream in vendor/
zendframework/ zend-diactoros/ src/ Response/ Serializer.php - Parse a response from a stream.
File
- vendor/
zendframework/ zend-diactoros/ src/ Response/ Serializer.php, line 97
Class
Namespace
Zend\Diactoros\ResponseCode
private static function getStatusLine(StreamInterface $stream) {
$line = self::getLine($stream);
if (!preg_match('#^HTTP/(?P<version>[1-9]\\d*\\.\\d) (?P<status>[1-5]\\d{2})(\\s+(?P<reason>.+))?$#', $line, $matches)) {
throw new UnexpectedValueException('No status line detected');
}
return [
$matches['version'],
$matches['status'],
isset($matches['reason']) ? $matches['reason'] : '',
];
}