/** * Compiles the node to PHP. * * @param Twig_Compiler A Twig_Compiler instance */ public function compile($compiler) { parent::compile($compiler); foreach ($this->getAttribute('imports') as $name => $alias) { $compiler->write('$context[')->repr('fn_' . $alias)->raw('] = new Twig_Function(')->subcompile($this->getNode('var'))->raw(', ')->repr($name)->raw(");\n"); } }