ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_Node_Expression_Function Class Reference
+ Inheritance diagram for Twig_Node_Expression_Function:
+ Collaboration diagram for Twig_Node_Expression_Function:

Public Member Functions

 __construct ($name, Twig_NodeInterface $arguments, $lineno)
 
 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 Member Functions inherited from Twig_Node_Expression_Call
 compileCallable (Twig_Compiler $compiler)
 
 compileArguments (Twig_Compiler $compiler)
 
 getArguments ($callable, $arguments)
 
 normalizeName ($name)
 
- Protected Attributes inherited from Twig_Node
 $nodes
 
 $attributes
 
 $lineno
 
 $tag
 

Detailed Description

Definition at line 11 of file Function.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Node_Expression_Function::__construct (   $name,
Twig_NodeInterface  $arguments,
  $lineno 
)

Definition at line 13 of file Function.php.

References Twig_Node\$lineno, and Twig_Node\$name.

14  {
15  parent::__construct(array('arguments' => $arguments), array('name' => $name, 'is_defined_test' => false), $lineno);
16  }
$lineno
Definition: Node.php:22

Member Function Documentation

◆ compile()

Twig_Node_Expression_Function::compile ( Twig_Compiler  $compiler)

Compiles the node to PHP.

Implements Twig_NodeInterface.

Definition at line 18 of file Function.php.

References Twig_Node\$name, Twig_Node_Expression_Call\compileCallable(), Twig_Node\getAttribute(), Twig_Compiler\getEnvironment(), and Twig_Node\setAttribute().

19  {
20  $name = $this->getAttribute('name');
21  $function = $compiler->getEnvironment()->getFunction($name);
22 
23  $this->setAttribute('name', $name);
24  $this->setAttribute('type', 'function');
25  $this->setAttribute('thing', $function);
26  $this->setAttribute('needs_environment', $function->needsEnvironment());
27  $this->setAttribute('needs_context', $function->needsContext());
28  $this->setAttribute('arguments', $function->getArguments());
29  if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) {
30  $callable = $function->getCallable();
31  if ('constant' === $name && $this->getAttribute('is_defined_test')) {
32  $callable = 'twig_constant_is_defined';
33  }
34 
35  $this->setAttribute('callable', $callable);
36  }
37  if ($function instanceof Twig_SimpleFunction) {
38  $this->setAttribute('is_variadic', $function->isVariadic());
39  }
40 
41  $this->compileCallable($compiler);
42  }
Represents a template function.
getAttribute($name)
Definition: Node.php:152
getEnvironment()
Returns the environment instance related to this compiler.
Definition: Compiler.php:50
setAttribute($name, $value)
Definition: Node.php:165
Represents a callable template function.
compileCallable(Twig_Compiler $compiler)
Definition: Call.php:15
+ Here is the call graph for this function:

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