public static function parse(string $headerValue): self
    {
        $self = new self();
        foreach (explode(',', $headerValue) as $acceptable) {
            // seems to be impossible to parse acceptables with regular
            // expressions or even scanf(), so we do some string crunching here
            if (strstr($acceptable, 'q=') !== false) {
                list($acceptable, $priority) = explode('q=', trim($acceptable));
            } else {
                $priority = 1;
            }

            settype($priority, 'float');
            $acceptable = trim($acceptable);
            if (substr($acceptable, -1) === ';') {
                $acceptable = substr($acceptable, 0, -1);
            }

            $self->addAcceptable($acceptable, $priority);
        }

        return $self;
    }
public static function parse(string $headerValue): self
    {
        $self = new self();
        foreach (explode(',', $headerValue) as $acceptable) {
            // seems to be impossible to parse acceptables with regular
            // expressions or even scanf(), so we do some string crunching here
            if (strstr($acceptable, 'q=') !== false) {
                list($acceptable, $priority) = explode('q=', trim($acceptable));
            } else {
                $priority = 1;
            }

            settype($priority, 'float');
            $acceptable = trim($acceptable);
            if (substr($acceptable, -1) === ';') {
                $acceptable = substr($acceptable, 0, -1);
            }

            $self->addAcceptable($acceptable, $priority);
        }

        return $self;
    }
public static function parse ( string $ headerValue ) : self { $ self = new self ( ) ; foreach ( explode ( ',' , $ headerValue ) as $ acceptable ) { // seems to be impossible to parse acceptables with regular // expressions or even scanf(), so we do some string crunching here if ( strstr ( $ acceptable , 'q=' ) !== false ) { list ( $ acceptable , $ priority ) = explode ( 'q=' , trim ( $ acceptable ) ) ; } else { $ priority = 1 ; } settype ( $ priority , 'float' ) ; $ acceptable = trim ( $ acceptable ) ; if ( substr ( $ acceptable , - 1 ) === ';' ) { $ acceptable = substr ( $ acceptable , 0 , - 1 ) ; } $ self -> addAcceptable ( $ acceptable , $ priority ) ; } return $ self ; }
method to create an instance from a string header value

@param   string  $headerValue
@return  \stubbles\peer\http\AcceptHeader
method to create an instance from a string header value