pQuery\HtmlParserBase::parse_tag_default PHP Method

parse_tag_default() public method

Default callback for tags
public parse_tag_default ( ) : boolean
return boolean
    function parse_tag_default()
    {
        if ($this->status['closing_tag']) {
            $this->status['attributes'] = array();
            $this->next_no_whitespace();
        } else {
            if (!$this->parse_attributes()) {
                return false;
            }
        }
        if ($this->token !== self::TOK_TAG_CLOSE) {
            if ($this->token === self::TOK_SLASH_FORWARD) {
                $this->status['self_close'] = true;
                $this->next();
            } elseif ($this->status['tag_name'][0] === '?' && $this->doc[$this->pos] === '?' || $this->status['tag_name'][0] === '%' && $this->doc[$this->pos] === '%') {
                $this->status['self_close'] = true;
                $this->pos++;
                if (isset($this->char_map[$this->doc[$this->pos]]) && !is_string($this->char_map[$this->doc[$this->pos]])) {
                    $this->token = $this->char_map[$this->doc[$this->pos]];
                } else {
                    $this->token = self::TOK_UNKNOWN;
                }
            }
            /* else {
            				$this->status['self_close'] = false;
            			}*/
        }
        if ($this->token !== self::TOK_TAG_CLOSE) {
            $this->addError('Expected ">", but found "' . $this->getTokenString() . '"');
            if ($this->next_pos('>', false) !== self::TOK_UNKNOWN) {
                $this->addError('No ">" tag found for "' . $this->status['tag_name'] . '" tag');
                return false;
            }
        }
        return true;
    }