Latte\Compiler::processHtmlAttributeBegin PHP Method

processHtmlAttributeBegin() private method

private processHtmlAttributeBegin ( latte\Token $token )
$token latte\Token
    private function processHtmlAttributeBegin(Token $token)
    {
        if (Helpers::startsWith($token->name, Parser::N_PREFIX)) {
            $name = substr($token->name, strlen(Parser::N_PREFIX));
            if (isset($this->htmlNode->macroAttrs[$name])) {
                throw new CompileException("Found multiple attributes {$token->name}.");
            } elseif ($this->macroNode && $this->macroNode->htmlNode === $this->htmlNode) {
                throw new CompileException("n:attributes must not appear inside macro; found {$token->name} inside {{$this->macroNode->name}}.");
            }
            $this->htmlNode->macroAttrs[$name] = $token->value;
            return;
        }
        $this->lastAttrValue =& $this->htmlNode->attrs[$token->name];
        $this->output .= $this->escape($token->text);
        $lower = strtolower($token->name);
        if (in_array($token->value, ['"', "'"], TRUE)) {
            $this->lastAttrValue = '';
            $this->context = self::CONTEXT_HTML_ATTRIBUTE;
            if (in_array($this->contentType, [self::CONTENT_HTML, self::CONTENT_XHTML], TRUE)) {
                if (Helpers::startsWith($lower, 'on')) {
                    $this->context = self::CONTEXT_HTML_ATTRIBUTE_JS;
                } elseif ($lower === 'style') {
                    $this->context = self::CONTEXT_HTML_ATTRIBUTE_CSS;
                }
            }
        } else {
            $this->lastAttrValue = $token->value;
            $this->context = self::CONTEXT_HTML_TAG;
        }
        if (in_array($this->contentType, [self::CONTENT_HTML, self::CONTENT_XHTML], TRUE) && (in_array($lower, ['href', 'src', 'action', 'formaction'], TRUE) || $lower === 'data' && strtolower($this->htmlNode->name) === 'object')) {
            $this->context = $this->context === self::CONTEXT_HTML_TAG ? self::CONTEXT_HTML_ATTRIBUTE_UNQUOTED_URL : self::CONTEXT_HTML_ATTRIBUTE_URL;
        }
    }