*/ class CaptureNode extends Node { public function __construct(Node $body, int $lineno) { parent::__construct(['body' => $body], ['raw' => false], $lineno); } public function compile(Compiler $compiler): void { if ($this->getAttribute('raw')) { $compiler->raw("implode('', iterator_to_array("); } else { $compiler->raw("('' === \$tmp = implode('', iterator_to_array("); } $compiler ->raw("(function () use (&\$context, \$macros, \$blocks) {\n") ->indent() ->subcompile($this->getNode('body')) ->write("return; yield;\n") ->outdent() ->write('})(), false))') ; if (!$this->getAttribute('raw')) { $compiler->raw(") ? '' : new Markup(\$tmp, \$this->env->getCharset());"); } else { $compiler->raw(';'); } } }