/** * Compile * * @param Apishka_Templater_Compiler $compiler */ public function compile(Apishka_Templater_Compiler $compiler) { $name = $this->getAttribute('name'); $test = $compiler->getEnvironment()->getTest($name); $this->setAttribute('name', $name); $this->setAttribute('type', 'test'); $this->setAttribute('callable', 'twig_test_empty'); $this->setAttribute('is_variadic', $test->isVariadic()); $this->compileCallable($compiler); }
public function compile(Apishka_Templater_Compiler $compiler) { $name = $this->getAttribute('name'); $function = $compiler->getEnvironment()->getFunction($name); $this->setAttribute('name', $name); $this->setAttribute('type', 'function'); $this->setAttribute('needs_environment', $function->needsEnvironment()); $this->setAttribute('needs_context', $function->needsContext()); $this->setAttribute('arguments', $function->getArguments()); $this->setAttribute('callable', $function->getCallable()); $this->setAttribute('is_variadic', $function->isVariadic()); $this->compileCallable($compiler); }
protected function compileClassHeader(Apishka_Templater_Compiler $compiler) { $compiler->write("\n\n")->write('/* ' . str_replace('*/', '* /', $this->getAttribute('filename')) . " */\n")->write('class ' . $compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename'), $this->getAttribute('index')))->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass()))->write("{\n")->indent(); }