public static function fromString($httpVersion): self
    {
        if (empty($httpVersion)) {
            throw new \InvalidArgumentException('Given HTTP version is empty');
        }

        $major = null;
        $minor = null;
        if (2 != sscanf($httpVersion, 'HTTP/%d.%d', $major, $minor)) {
            throw new \InvalidArgumentException(
                    'Given HTTP version "' . $httpVersion . '" can not be parsed'
            );
        }

        return new self($major, $minor);
    }
public static function fromString($httpVersion): self
    {
        if (empty($httpVersion)) {
            throw new \InvalidArgumentException('Given HTTP version is empty');
        }

        $major = null;
        $minor = null;
        if (2 != sscanf($httpVersion, 'HTTP/%d.%d', $major, $minor)) {
            throw new \InvalidArgumentException(
                    'Given HTTP version "' . $httpVersion . '" can not be parsed'
            );
        }

        return new self($major, $minor);
    }
public static function fromString ( $ httpVersion ) : self { if ( empty ( $ httpVersion ) ) { throw new \ InvalidArgumentException ( 'Given HTTP version is empty' ) ; } $ major = null ; $ minor = null ; if ( 2 != sscanf ( $ httpVersion , 'HTTP/%d.%d' , $ major , $ minor ) ) { throw new \ InvalidArgumentException ( 'Given HTTP version "' . $ httpVersion . '" can not be parsed' ) ; } return new self ( $ major , $ minor ) ; }
parses http version from given string

@param   string  $httpVersion  a http version string like "HTTP/1.1"
@return  HttpVersion
@throws  \InvalidArgumentException  in case string can not be parsed successfully
parses http version from given string