src/Request/Serializer.php
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']];
    }
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']];
    }
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' ] ] ; }
Retrieve the components of the request line.

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.

@param StreamInterface $stream
@return array
Retrieve the components of the request line .