Latte\Macros\CoreMacros::macroIf PHP Method

macroIf() public method

..}
public macroIf ( MacroNode $node, PhpWriter $writer )
$node Latte\MacroNode
$writer Latte\PhpWriter
    public function macroIf(MacroNode $node, PhpWriter $writer)
    {
        if ($node->modifiers) {
            throw new CompileException('Modifiers are not allowed in ' . $node->getNotation());
        }
        if ($node->data->capture = $node->args === '') {
            return 'ob_start(function () {})';
        }
        if ($node->prefix === $node::PREFIX_TAG) {
            return $writer->write($node->htmlNode->closing ? 'if (array_pop($this->global->ifs)) {' : 'if ($this->global->ifs[] = (%node.args)) {');
        }
        return $writer->write('if (%node.args) {');
    }