SimpleHtmlSaxParser::acceptStartToken PHP Method

acceptStartToken() public method

If the starting element completes then the element is dispatched and the current attributes set back to empty. The element or attribute name is converted to lower case.
public acceptStartToken ( string $token, integer $event ) : boolean
$token string Incoming characters.
$event integer Lexer event type.
return boolean False if parse error.
    public function acceptStartToken($token, $event)
    {
        if ($event == LEXER_ENTER) {
            $this->tag = strtolower(substr($token, 1));
            return true;
        }
        if ($event == LEXER_EXIT) {
            $success = $this->listener->startElement($this->tag, $this->attributes);
            $this->tag = '';
            $this->attributes = array();
            return $success;
        }
        if ($token !== '=') {
            $this->current_attribute = strtolower(html_entity_decode($token, ENT_QUOTES));
            $this->attributes[$this->current_attribute] = '';
        }
        return true;
    }