Latte\Compiler::closeMacro PHP Method

closeMacro() public method

..} to the output.
public closeMacro ( $name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL ) : MacroNode
return MacroNode
    public function closeMacro($name, $args = NULL, $modifiers = NULL, $isRightmost = FALSE, $nPrefix = NULL)
    {
        $node = $this->macroNode;
        if (!$node || $node->name !== $name && '' !== $name || $modifiers || $args && $node->args && !Helpers::startsWith("{$node->args} ", "{$args} ") || $nPrefix !== $node->prefix) {
            $name = $nPrefix ? "</{$this->htmlNode->name}> for " . Parser::N_PREFIX . implode(' and ' . Parser::N_PREFIX, array_keys($this->htmlNode->macroAttrs)) : '{/' . $name . ($args ? ' ' . $args : '') . $modifiers . '}';
            throw new CompileException("Unexpected {$name}" . ($node ? ', expecting ' . self::printEndTag($node->prefix ? $this->htmlNode : $node) : ''));
        }
        $this->macroNode = $node->parentNode;
        if (!$node->args) {
            $node->setArgs($args);
        }
        if ($node->prefix === MacroNode::PREFIX_NONE) {
            $parts = explode($node->htmlNode->innerMarker, $node->content);
            if (count($parts) === 3) {
                // markers may be destroyed by inner macro
                $node->innerContent = $parts[1];
            }
        }
        $node->closing = TRUE;
        $node->endLine = $node->prefix ? $node->htmlNode->endLine : $this->getLine();
        $node->macro->nodeClosed($node);
        if (isset($parts[1]) && $node->innerContent !== $parts[1]) {
            $node->content = implode($node->htmlNode->innerMarker, [$parts[0], $node->innerContent, $parts[2]]);
        }
        if ($node->prefix && $node->prefix !== MacroNode::PREFIX_TAG) {
            $this->htmlNode->attrCode .= $node->attrCode;
        }
        $this->output =& $node->saved[0];
        $this->writeCode($node->openingCode, $node->replaced, $node->saved[1]);
        $this->output .= $node->content;
        $this->writeCode($node->closingCode, $node->replaced, $isRightmost);
        return $node;
    }