pQuery\HtmlParserBase::parse_attributes PHP Метод

parse_attributes() публичный Метод

Parse attributes (names + value)
public parse_attributes ( ) : boolean
Результат boolean
    function parse_attributes()
    {
        $this->status['attributes'] = array();
        while ($this->next_no_whitespace() === self::TOK_IDENTIFIER) {
            $attr = $this->getTokenString();
            if ($attr === '?' || $attr === '%') {
                //Probably closing tags
                break;
            }
            if ($this->next_no_whitespace() === self::TOK_EQUALS) {
                if ($this->next_no_whitespace() === self::TOK_STRING) {
                    $val = $this->getTokenString(1, -1);
                } else {
                    $this->token_start = $this->pos;
                    if (!isset($stop)) {
                        $stop = $this->whitespace;
                        $stop['<'] = true;
                        $stop['>'] = true;
                    }
                    while (++$this->pos < $this->size && !isset($stop[$this->doc[$this->pos]])) {
                        // Do nothing.
                    }
                    --$this->pos;
                    $val = $this->getTokenString();
                    if (trim($val) === '') {
                        $this->addError('Invalid attribute value');
                        return false;
                    }
                }
            } else {
                $val = $attr;
                $this->pos = ($this->token_start ? $this->token_start : $this->pos) - 1;
            }
            $this->status['attributes'][$attr] = $val;
        }
        return true;
    }