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

Represents a module node. More...

+ Inheritance diagram for Twig_Node_Module:
+ Collaboration diagram for Twig_Node_Module:

Public Member Functions

 __construct (Twig_NodeInterface $body, Twig_Node_Expression $parent=null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $name, $source='')
 
 setIndex ($index)
 
 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 ()
 

Protected Member Functions

 compileTemplate (Twig_Compiler $compiler)
 
 compileGetParent (Twig_Compiler $compiler)
 
 compileClassHeader (Twig_Compiler $compiler)
 
 compileConstructor (Twig_Compiler $compiler)
 
 compileDisplay (Twig_Compiler $compiler)
 
 compileClassFooter (Twig_Compiler $compiler)
 
 compileMacros (Twig_Compiler $compiler)
 
 compileGetTemplateName (Twig_Compiler $compiler)
 
 compileIsTraitable (Twig_Compiler $compiler)
 
 compileDebugInfo (Twig_Compiler $compiler)
 
 compileGetSource (Twig_Compiler $compiler)
 
 compileGetSourceContext (Twig_Compiler $compiler)
 
 compileLoadTemplate (Twig_Compiler $compiler, $node, $var)
 

Private Attributes

 $source
 

Additional Inherited Members

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

Detailed Description

Represents a module node.

Consider this class as being final. If you need to customize the behavior of the generated class, consider adding nodes to the following nodes: display_start, display_end, constructor_start, constructor_end, and class_end.

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

Definition at line 22 of file Module.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Node_Module::__construct ( Twig_NodeInterface  $body,
Twig_Node_Expression  $parent = null,
Twig_NodeInterface  $blocks,
Twig_NodeInterface  $macros,
Twig_NodeInterface  $traits,
  $embeddedTemplates,
  $name,
  $source = '' 
)

Definition at line 26 of file Module.php.

References Twig_Node\$name, Twig_Node\$nodes, $source, array, and Twig_Node\setTemplateName().

27  {
28  if (!$name instanceof Twig_Source) {
29  @trigger_error(sprintf('Passing a string as the $name argument of %s() is deprecated since version 1.27. Pass a Twig_Source instance instead.', __METHOD__), E_USER_DEPRECATED);
30  $this->source = new Twig_Source($source, $name);
31  } else {
32  $this->source = $name;
33  }
34 
35  $nodes = array(
36  'body' => $body,
37  'blocks' => $blocks,
38  'macros' => $macros,
39  'traits' => $traits,
40  'display_start' => new Twig_Node(),
41  'display_end' => new Twig_Node(),
42  'constructor_start' => new Twig_Node(),
43  'constructor_end' => new Twig_Node(),
44  'class_end' => new Twig_Node(),
45  );
46  if (null !== $parent) {
47  $nodes['parent'] = $parent;
48  }
49 
50  // embedded templates are set as attributes so that they are only visited once by the visitors
51  parent::__construct($nodes, array(
52  // source to be remove in 2.0
53  'source' => $this->source->getCode(),
54  // filename to be remove in 2.0 (use getTemplateName() instead)
55  'filename' => $this->source->getName(),
56  'index' => null,
57  'embedded_templates' => $embeddedTemplates,
58  ), 1);
59 
60  // populate the template name of all node children
61  $this->setTemplateName($this->source->getName());
62  }
Represents a node in the AST.
Definition: Node.php:18
setTemplateName($name)
Definition: Node.php:219
$nodes
Definition: Node.php:20
Create styles array
The data for the language used.
Holds information about a non-compiled Twig template.
Definition: Source.php:19
+ Here is the call graph for this function:

Member Function Documentation

◆ compile()

Twig_Node_Module::compile ( Twig_Compiler  $compiler)

Compiles the node to PHP.

Implements Twig_NodeInterface.

Definition at line 69 of file Module.php.

References $template, compileTemplate(), Twig_Node\getAttribute(), and Twig_Compiler\subcompile().

70  {
71  $this->compileTemplate($compiler);
72 
73  foreach ($this->getAttribute('embedded_templates') as $template) {
74  $compiler->subcompile($template);
75  }
76  }
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:94
$template
getAttribute($name)
Definition: Node.php:152
compileTemplate(Twig_Compiler $compiler)
Definition: Module.php:78
+ Here is the call graph for this function:

◆ compileClassFooter()

Twig_Node_Module::compileClassFooter ( Twig_Compiler  $compiler)
protected

Definition at line 322 of file Module.php.

References Twig_Node\getNode(), and Twig_Compiler\subcompile().

Referenced by compileTemplate().

323  {
324  $compiler
325  ->subcompile($this->getNode('class_end'))
326  ->outdent()
327  ->write("}\n")
328  ;
329  }
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:94
getNode($name)
Definition: Node.php:186
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileClassHeader()

Twig_Node_Module::compileClassHeader ( Twig_Compiler  $compiler)
protected

Definition at line 153 of file Module.php.

References Twig_Node\getAttribute(), Twig_Compiler\getEnvironment(), and Twig_Compiler\write().

Referenced by compileTemplate().

154  {
155  $compiler
156  ->write("\n\n")
157  // if the template name contains */, add a blank to avoid a PHP parse error
158  ->write('/* '.str_replace('*/', '* /', $this->source->getName())." */\n")
159  ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->source->getName(), $this->getAttribute('index')))
160  ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass()))
161  ->write("{\n")
162  ->indent()
163  ;
164  }
getAttribute($name)
Definition: Node.php:152
getEnvironment()
Returns the environment instance related to this compiler.
Definition: Compiler.php:50
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileConstructor()

Twig_Node_Module::compileConstructor ( Twig_Compiler  $compiler)
protected

Definition at line 166 of file Module.php.

References $i, $key, Twig_Node\$name, Twig_Compiler\addDebugInfo(), compileLoadTemplate(), Twig_Node\count(), Twig_Node\getNode(), Twig_Node\hasNode(), Twig_Compiler\indent(), Twig_Compiler\outdent(), and Twig_Compiler\write().

Referenced by compileTemplate().

167  {
168  $compiler
169  ->write("public function __construct(Twig_Environment \$env)\n", "{\n")
170  ->indent()
171  ->subcompile($this->getNode('constructor_start'))
172  ->write("parent::__construct(\$env);\n\n")
173  ;
174 
175  // parent
176  if (!$this->hasNode('parent')) {
177  $compiler->write("\$this->parent = false;\n\n");
178  } elseif (($parent = $this->getNode('parent')) && $parent instanceof Twig_Node_Expression_Constant) {
179  $compiler
180  ->addDebugInfo($parent)
181  ->write('$this->parent = $this->loadTemplate(')
182  ->subcompile($parent)
183  ->raw(', ')
184  ->repr($this->source->getName())
185  ->raw(', ')
186  ->repr($parent->getTemplateLine())
187  ->raw(");\n")
188  ;
189  }
190 
191  $countTraits = count($this->getNode('traits'));
192  if ($countTraits) {
193  // traits
194  foreach ($this->getNode('traits') as $i => $trait) {
195  $this->compileLoadTemplate($compiler, $trait->getNode('template'), sprintf('$_trait_%s', $i));
196 
197  $compiler
198  ->addDebugInfo($trait->getNode('template'))
199  ->write(sprintf("if (!\$_trait_%s->isTraitable()) {\n", $i))
200  ->indent()
201  ->write("throw new Twig_Error_Runtime('Template \"'.")
202  ->subcompile($trait->getNode('template'))
203  ->raw(".'\" cannot be used as a trait.');\n")
204  ->outdent()
205  ->write("}\n")
206  ->write(sprintf("\$_trait_%s_blocks = \$_trait_%s->getBlocks();\n\n", $i, $i))
207  ;
208 
209  foreach ($trait->getNode('targets') as $key => $value) {
210  $compiler
211  ->write(sprintf('if (!isset($_trait_%s_blocks[', $i))
212  ->string($key)
213  ->raw("])) {\n")
214  ->indent()
215  ->write("throw new Twig_Error_Runtime(sprintf('Block ")
216  ->string($key)
217  ->raw(' is not defined in trait ')
218  ->subcompile($trait->getNode('template'))
219  ->raw(".'));\n")
220  ->outdent()
221  ->write("}\n\n")
222 
223  ->write(sprintf('$_trait_%s_blocks[', $i))
224  ->subcompile($value)
225  ->raw(sprintf('] = $_trait_%s_blocks[', $i))
226  ->string($key)
227  ->raw(sprintf(']; unset($_trait_%s_blocks[', $i))
228  ->string($key)
229  ->raw("]);\n\n")
230  ;
231  }
232  }
233 
234  if ($countTraits > 1) {
235  $compiler
236  ->write("\$this->traits = array_merge(\n")
237  ->indent()
238  ;
239 
240  for ($i = 0; $i < $countTraits; ++$i) {
241  $compiler
242  ->write(sprintf('$_trait_%s_blocks'.($i == $countTraits - 1 ? '' : ',')."\n", $i))
243  ;
244  }
245 
246  $compiler
247  ->outdent()
248  ->write(");\n\n")
249  ;
250  } else {
251  $compiler
252  ->write("\$this->traits = \$_trait_0_blocks;\n\n")
253  ;
254  }
255 
256  $compiler
257  ->write("\$this->blocks = array_merge(\n")
258  ->indent()
259  ->write("\$this->traits,\n")
260  ->write("array(\n")
261  ;
262  } else {
263  $compiler
264  ->write("\$this->blocks = array(\n")
265  ;
266  }
267 
268  // blocks
269  $compiler
270  ->indent()
271  ;
272 
273  foreach ($this->getNode('blocks') as $name => $node) {
274  $compiler
275  ->write(sprintf("'%s' => array(\$this, 'block_%s'),\n", $name, $name))
276  ;
277  }
278 
279  if ($countTraits) {
280  $compiler
281  ->outdent()
282  ->write(")\n")
283  ;
284  }
285 
286  $compiler
287  ->outdent()
288  ->write(");\n")
289  ->outdent()
290  ->subcompile($this->getNode('constructor_end'))
291  ->write("}\n\n")
292  ;
293  }
outdent($step=1)
Outdents the generated code.
Definition: Compiler.php:267
indent($step=1)
Indents the generated code.
Definition: Compiler.php:251
hasNode($name)
Definition: Node.php:178
getNode($name)
Definition: Node.php:186
$i
Definition: disco.tpl.php:19
count()
Definition: Node.php:209
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
Definition: Compiler.php:212
$key
Definition: croninfo.php:18
compileLoadTemplate(Twig_Compiler $compiler, $node, $var)
Definition: Module.php:443
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileDebugInfo()

Twig_Node_Module::compileDebugInfo ( Twig_Compiler  $compiler)
protected

Definition at line 401 of file Module.php.

References Twig_Compiler\getDebugInfo(), and Twig_Compiler\write().

Referenced by compileTemplate().

402  {
403  $compiler
404  ->write("public function getDebugInfo()\n", "{\n")
405  ->indent()
406  ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true))))
407  ->outdent()
408  ->write("}\n\n")
409  ;
410  }
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileDisplay()

Twig_Node_Module::compileDisplay ( Twig_Compiler  $compiler)
protected

Definition at line 295 of file Module.php.

References Twig_Compiler\addDebugInfo(), Twig_Node\getNode(), Twig_Node\hasNode(), Twig_Compiler\raw(), Twig_Compiler\subcompile(), and Twig_Compiler\write().

Referenced by compileTemplate().

296  {
297  $compiler
298  ->write("protected function doDisplay(array \$context, array \$blocks = array())\n", "{\n")
299  ->indent()
300  ->subcompile($this->getNode('display_start'))
301  ->subcompile($this->getNode('body'))
302  ;
303 
304  if ($this->hasNode('parent')) {
305  $parent = $this->getNode('parent');
306  $compiler->addDebugInfo($parent);
307  if ($parent instanceof Twig_Node_Expression_Constant) {
308  $compiler->write('$this->parent');
309  } else {
310  $compiler->write('$this->getParent($context)');
311  }
312  $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n");
313  }
314 
315  $compiler
316  ->subcompile($this->getNode('display_end'))
317  ->outdent()
318  ->write("}\n\n")
319  ;
320  }
raw($string)
Adds a raw string to the compiled code.
Definition: Compiler.php:112
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:94
hasNode($name)
Definition: Node.php:178
getNode($name)
Definition: Node.php:186
addDebugInfo(Twig_NodeInterface $node)
Adds debugging information.
Definition: Compiler.php:212
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileGetParent()

Twig_Node_Module::compileGetParent ( Twig_Compiler  $compiler)
protected

Definition at line 118 of file Module.php.

References Twig_Node\getNode(), Twig_Node\hasNode(), Twig_Compiler\raw(), Twig_Compiler\subcompile(), and Twig_Compiler\write().

Referenced by compileTemplate().

119  {
120  if (!$this->hasNode('parent')) {
121  return;
122  }
123  $parent = $this->getNode('parent');
124 
125  $compiler
126  ->write("protected function doGetParent(array \$context)\n", "{\n")
127  ->indent()
128  ->addDebugInfo($parent)
129  ->write('return ')
130  ;
131 
132  if ($parent instanceof Twig_Node_Expression_Constant) {
133  $compiler->subcompile($parent);
134  } else {
135  $compiler
136  ->raw('$this->loadTemplate(')
137  ->subcompile($parent)
138  ->raw(', ')
139  ->repr($this->source->getName())
140  ->raw(', ')
141  ->repr($parent->getTemplateLine())
142  ->raw(')')
143  ;
144  }
145 
146  $compiler
147  ->raw(";\n")
148  ->outdent()
149  ->write("}\n\n")
150  ;
151  }
raw($string)
Adds a raw string to the compiled code.
Definition: Compiler.php:112
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:94
hasNode($name)
Definition: Node.php:178
getNode($name)
Definition: Node.php:186
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileGetSource()

Twig_Node_Module::compileGetSource ( Twig_Compiler  $compiler)
protected

Definition at line 412 of file Module.php.

References Twig_Compiler\write().

Referenced by compileTemplate().

413  {
414  $compiler
415  ->write("/** @deprecated since 1.27 (to be removed in 2.0). Use getSourceContext() instead */\n")
416  ->write("public function getSource()\n", "{\n")
417  ->indent()
418  ->write("@trigger_error('The '.__METHOD__.' method is deprecated since version 1.27 and will be removed in 2.0. Use getSourceContext() instead.', E_USER_DEPRECATED);\n\n")
419  ->write('return $this->getSourceContext()->getCode();')
420  ->raw("\n")
421  ->outdent()
422  ->write("}\n\n")
423  ;
424  }
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileGetSourceContext()

Twig_Node_Module::compileGetSourceContext ( Twig_Compiler  $compiler)
protected

Definition at line 426 of file Module.php.

References Twig_Compiler\getEnvironment(), and Twig_Compiler\write().

Referenced by compileTemplate().

427  {
428  $compiler
429  ->write("public function getSourceContext()\n", "{\n")
430  ->indent()
431  ->write('return new Twig_Source(')
432  ->string($compiler->getEnvironment()->isDebug() ? $this->source->getCode() : '')
433  ->raw(', ')
434  ->string($this->source->getName())
435  ->raw(', ')
436  ->string($this->source->getPath())
437  ->raw(");\n")
438  ->outdent()
439  ->write("}\n")
440  ;
441  }
getEnvironment()
Returns the environment instance related to this compiler.
Definition: Compiler.php:50
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileGetTemplateName()

Twig_Node_Module::compileGetTemplateName ( Twig_Compiler  $compiler)
protected

Definition at line 336 of file Module.php.

References Twig_Compiler\write().

Referenced by compileTemplate().

337  {
338  $compiler
339  ->write("public function getTemplateName()\n", "{\n")
340  ->indent()
341  ->write('return ')
342  ->repr($this->source->getName())
343  ->raw(";\n")
344  ->outdent()
345  ->write("}\n\n")
346  ;
347  }
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileIsTraitable()

Twig_Node_Module::compileIsTraitable ( Twig_Compiler  $compiler)
protected

Definition at line 349 of file Module.php.

References Twig_Node\$nodes, array, Twig_Node\count(), Twig_Node\getNode(), Twig_Node\hasNode(), and Twig_Compiler\write().

Referenced by compileTemplate().

350  {
351  // A template can be used as a trait if:
352  // * it has no parent
353  // * it has no macros
354  // * it has no body
355  //
356  // Put another way, a template can be used as a trait if it
357  // only contains blocks and use statements.
358  $traitable = !$this->hasNode('parent') && 0 === count($this->getNode('macros'));
359  if ($traitable) {
360  if ($this->getNode('body') instanceof Twig_Node_Body) {
361  $nodes = $this->getNode('body')->getNode(0);
362  } else {
363  $nodes = $this->getNode('body');
364  }
365 
366  if (!count($nodes)) {
367  $nodes = new Twig_Node(array($nodes));
368  }
369 
370  foreach ($nodes as $node) {
371  if (!count($node)) {
372  continue;
373  }
374 
375  if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) {
376  continue;
377  }
378 
379  if ($node instanceof Twig_Node_BlockReference) {
380  continue;
381  }
382 
383  $traitable = false;
384  break;
385  }
386  }
387 
388  if ($traitable) {
389  return;
390  }
391 
392  $compiler
393  ->write("public function isTraitable()\n", "{\n")
394  ->indent()
395  ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false'))
396  ->outdent()
397  ->write("}\n\n")
398  ;
399  }
Represents a node in the AST.
Definition: Node.php:18
Represents a block call node.
$nodes
Definition: Node.php:20
Represents a body node.
Definition: Body.php:17
hasNode($name)
Definition: Node.php:178
Create styles array
The data for the language used.
getNode($name)
Definition: Node.php:186
Represents a text node.
Definition: Text.php:18
count()
Definition: Node.php:209
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileLoadTemplate()

Twig_Node_Module::compileLoadTemplate ( Twig_Compiler  $compiler,
  $node,
  $var 
)
protected

Definition at line 443 of file Module.php.

References Twig_Compiler\write().

Referenced by compileConstructor().

444  {
445  if ($node instanceof Twig_Node_Expression_Constant) {
446  $compiler
447  ->write(sprintf('%s = $this->loadTemplate(', $var))
448  ->subcompile($node)
449  ->raw(', ')
450  ->repr($node->getTemplateName())
451  ->raw(', ')
452  ->repr($node->getTemplateLine())
453  ->raw(");\n")
454  ;
455  } else {
456  throw new LogicException('Trait templates can only be constant nodes.');
457  }
458  }
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileMacros()

Twig_Node_Module::compileMacros ( Twig_Compiler  $compiler)
protected

Definition at line 331 of file Module.php.

References Twig_Node\getNode(), and Twig_Compiler\subcompile().

Referenced by compileTemplate().

332  {
333  $compiler->subcompile($this->getNode('macros'));
334  }
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:94
getNode($name)
Definition: Node.php:186
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compileTemplate()

Twig_Node_Module::compileTemplate ( Twig_Compiler  $compiler)
protected

Definition at line 78 of file Module.php.

References compileClassFooter(), compileClassHeader(), compileConstructor(), compileDebugInfo(), compileDisplay(), compileGetParent(), compileGetSource(), compileGetSourceContext(), compileGetTemplateName(), compileIsTraitable(), compileMacros(), Twig_Node\count(), Twig_Node\getAttribute(), Twig_Node\getNode(), Twig_Node\hasNode(), Twig_Compiler\subcompile(), and Twig_Compiler\write().

Referenced by compile().

79  {
80  if (!$this->getAttribute('index')) {
81  $compiler->write('<?php');
82  }
83 
84  $this->compileClassHeader($compiler);
85 
86  if (
87  count($this->getNode('blocks'))
88  || count($this->getNode('traits'))
89  || !$this->hasNode('parent')
90  || $this->getNode('parent') instanceof Twig_Node_Expression_Constant
91  || count($this->getNode('constructor_start'))
92  || count($this->getNode('constructor_end'))
93  ) {
94  $this->compileConstructor($compiler);
95  }
96 
97  $this->compileGetParent($compiler);
98 
99  $this->compileDisplay($compiler);
100 
101  $compiler->subcompile($this->getNode('blocks'));
102 
103  $this->compileMacros($compiler);
104 
105  $this->compileGetTemplateName($compiler);
106 
107  $this->compileIsTraitable($compiler);
108 
109  $this->compileDebugInfo($compiler);
110 
111  $this->compileGetSource($compiler);
112 
113  $this->compileGetSourceContext($compiler);
114 
115  $this->compileClassFooter($compiler);
116  }
compileGetSourceContext(Twig_Compiler $compiler)
Definition: Module.php:426
subcompile(Twig_NodeInterface $node, $raw=true)
Definition: Compiler.php:94
compileGetSource(Twig_Compiler $compiler)
Definition: Module.php:412
compileClassHeader(Twig_Compiler $compiler)
Definition: Module.php:153
compileGetTemplateName(Twig_Compiler $compiler)
Definition: Module.php:336
compileConstructor(Twig_Compiler $compiler)
Definition: Module.php:166
compileDebugInfo(Twig_Compiler $compiler)
Definition: Module.php:401
compileIsTraitable(Twig_Compiler $compiler)
Definition: Module.php:349
getAttribute($name)
Definition: Node.php:152
hasNode($name)
Definition: Node.php:178
compileMacros(Twig_Compiler $compiler)
Definition: Module.php:331
getNode($name)
Definition: Node.php:186
compileGetParent(Twig_Compiler $compiler)
Definition: Module.php:118
count()
Definition: Node.php:209
compileClassFooter(Twig_Compiler $compiler)
Definition: Module.php:322
write()
Writes a string to the compiled code by adding indentation.
Definition: Compiler.php:124
compileDisplay(Twig_Compiler $compiler)
Definition: Module.php:295
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIndex()

Twig_Node_Module::setIndex (   $index)

Definition at line 64 of file Module.php.

References $index, and Twig_Node\setAttribute().

Referenced by Twig_Parser\embedTemplate().

65  {
66  $this->setAttribute('index', $index);
67  }
$index
Definition: metadata.php:60
setAttribute($name, $value)
Definition: Node.php:165
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $source

Twig_Node_Module::$source
private

Definition at line 24 of file Module.php.

Referenced by __construct().


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