ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Twig_Node_Import Class Reference

Represents an import node. More...

+ Inheritance diagram for Twig_Node_Import:
+ Collaboration diagram for Twig_Node_Import:

Public Member Functions

 __construct (Twig_Node_Expression $expr, Twig_Node_Expression $var, $lineno, $tag=null)
 
 compile (Twig_Compiler $compiler)
 Compiles the node to PHP. More...
 
- Public Member Functions inherited from Twig_Node
 __construct (array $nodes=array(), array $attributes=array(), $lineno=0, $tag=null)
 Constructor. More...
 
 __toString ()
 
 toXml ($asDom=false)
 
 compile (Twig_Compiler $compiler)
 Compiles the node to PHP. More...
 
 getTemplateLine ()
 
 getLine ()
 
 getNodeTag ()
 
 hasAttribute ($name)
 
 getAttribute ($name)
 
 setAttribute ($name, $value)
 
 removeAttribute ($name)
 
 hasNode ($name)
 
 getNode ($name)
 
 setNode ($name, $node=null)
 
 removeNode ($name)
 
 count ()
 
 getIterator ()
 
 setTemplateName ($name)
 
 getTemplateName ()
 
 setFilename ($name)
 
 getFilename ()
 

Additional Inherited Members

- Protected Attributes inherited from Twig_Node
 $nodes
 
 $attributes
 
 $lineno
 
 $tag
 

Detailed Description

Represents an import node.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 17 of file Import.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Node_Import::__construct ( Twig_Node_Expression  $expr,
Twig_Node_Expression  $var,
  $lineno,
  $tag = null 
)

Definition at line 19 of file Import.php.

References Twig_Node\$lineno, Twig_Node\$tag, and array.

20  {
21  parent::__construct(array('expr' => $expr, 'var' => $var), array(), $lineno, $tag);
22  }
$lineno
Definition: Node.php:22
Create styles array
The data for the language used.

Member Function Documentation

◆ compile()

Twig_Node_Import::compile ( Twig_Compiler  $compiler)

Compiles the node to PHP.

Implements Twig_NodeInterface.

Definition at line 24 of file Import.php.

References Twig_Compiler\addDebugInfo(), Twig_Node\getAttribute(), Twig_Node\getNode(), Twig_Node\getTemplateLine(), Twig_Node\getTemplateName(), and Twig_Compiler\raw().

25  {
26  $compiler
27  ->addDebugInfo($this)
28  ->write('')
29  ->subcompile($this->getNode('var'))
30  ->raw(' = ')
31  ;
32 
33  if ($this->getNode('expr') instanceof Twig_Node_Expression_Name && '_self' === $this->getNode('expr')->getAttribute('name')) {
34  $compiler->raw('$this');
35  } else {
36  $compiler
37  ->raw('$this->loadTemplate(')
38  ->subcompile($this->getNode('expr'))
39  ->raw(', ')
40  ->repr($this->getTemplateName())
41  ->raw(', ')
42  ->repr($this->getTemplateLine())
43  ->raw(')')
44  ;
45  }
46 
47  $compiler->raw(";\n");
48  }
raw($string)
Adds a raw string to the compiled code.
Definition: Compiler.php:112
getTemplateName()
Definition: Node.php:229
getAttribute($name)
Definition: Node.php:152
getTemplateLine()
Definition: Node.php:121
getNode($name)
Definition: Node.php:186
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
Definition: Compiler.php:212
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: