src/Http/Helpers.php
public static function getProtocol(array $server): string
    {
        if (!isset($server['SERVER_PROTOCOL'])) {
            return '1.1';
        }

        if (!\preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) {
            throw new \UnexpectedValueException("Unrecognized protocol version ({$server['SERVER_PROTOCOL']})");
        }

        return $matches['version'];
    }
public static function getProtocol(array $server): string
    {
        if (!isset($server['SERVER_PROTOCOL'])) {
            return '1.1';
        }

        if (!\preg_match('#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#', $server['SERVER_PROTOCOL'], $matches)) {
            throw new \UnexpectedValueException("Unrecognized protocol version ({$server['SERVER_PROTOCOL']})");
        }

        return $matches['version'];
    }
public static function getProtocol ( array $ server ) : string { if ( ! isset ( $ server [ 'SERVER_PROTOCOL' ] ) ) { return '1.1' ; } if ( ! \ preg_match ( '#^(HTTP/)?(?P<version>[1-9]\d*(?:\.\d)?)$#' , $ server [ 'SERVER_PROTOCOL' ] , $ matches ) ) { throw new \ UnexpectedValueException ( "Unrecognized protocol version ({$server['SERVER_PROTOCOL']})" ) ; } return $ matches [ 'version' ] ; }
Get protocol from server variables.

@param array $server Typically $_SERVER or similar structure.

@return string
@throws \UnexpectedValueException
Get protocol from server variables .