ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SetTemp.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
16 {
17  public function __construct($name, $lineno)
18  {
19  parent::__construct(array(), array('name' => $name), $lineno);
20  }
21 
22  public function compile(Twig_Compiler $compiler)
23  {
24  $name = $this->getAttribute('name');
25  $compiler
26  ->addDebugInfo($this)
27  ->write('if (isset($context[')
28  ->string($name)
29  ->raw('])) { $_')
30  ->raw($name)
31  ->raw('_ = $context[')
32  ->repr($name)
33  ->raw(']; } else { $_')
34  ->raw($name)
35  ->raw("_ = null; }\n")
36  ;
37  }
38 }
39 
40 class_alias('Twig_Node_SetTemp', 'Twig\Node\SetTempNode', false);
$lineno
Definition: Node.php:22
__construct($name, $lineno)
Definition: SetTemp.php:17
Represents a node in the AST.
Definition: Node.php:18
getAttribute($name)
Definition: Node.php:152
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
Definition: Compiler.php:212
compile(Twig_Compiler $compiler)
Compiles the node to PHP.
Definition: SetTemp.php:22