ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
40class_alias('Twig_Node_SetTemp', 'Twig\Node\SetTempNode', false);
An exception for terminatinating execution or to throw for unit testing.
Compiles a node to PHP code.
Definition: Compiler.php:19
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
Definition: Compiler.php:212
__construct($name, $lineno)
Definition: SetTemp.php:17
compile(Twig_Compiler $compiler)
Compiles the node to PHP.
Definition: SetTemp.php:22
Represents a node in the AST.
Definition: Node.php:19
getAttribute($name)
Definition: Node.php:152
$lineno
Definition: Node.php:22