コード例 #1
0
ファイル: Empty.php プロジェクト: apishka/templater
 /**
  * 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);
 }
コード例 #2
0
ファイル: Function.php プロジェクト: apishka/templater
 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);
 }
コード例 #3
0
ファイル: Module.php プロジェクト: apishka/templater
 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();
 }