Zend\Diactoros\Request\Serializer::getRequestLine PHP Méthode

getRequestLine() private static méthode

Retrieves the first line of the stream and parses it, raising an exception if it does not follow specifications; if valid, returns a list with the method, target, and version, in that order.
private static getRequestLine ( Psr\Http\Message\StreamInterface $stream ) : array
$stream Psr\Http\Message\StreamInterface
Résultat array
    private static function getRequestLine(StreamInterface $stream)
    {
        $requestLine = self::getLine($stream);
        if (!preg_match('#^(?P<method>[!\\#$%&\'*+.^_`|~a-zA-Z0-9-]+) (?P<target>[^\\s]+) HTTP/(?P<version>[1-9]\\d*\\.\\d+)$#', $requestLine, $matches)) {
            throw new UnexpectedValueException('Invalid request line detected');
        }
        return [$matches['method'], $matches['target'], $matches['version']];
    }