ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Twig_Function Class Reference

Represents a template function. More...

+ Inheritance diagram for Twig_Function:
+ Collaboration diagram for Twig_Function:

Public Member Functions

 __construct (array $options=array())
 
 setArguments ($arguments)
 
 getArguments ()
 
 needsEnvironment ()
 
 needsContext ()
 
 getSafe (Twig_Node $functionArgs)
 
 getCallable ()
 
- Public Member Functions inherited from Twig_FunctionInterface
 compile ()
 Compiles a function. More...
 
 needsEnvironment ()
 
 needsContext ()
 
 getSafe (Twig_Node $filterArgs)
 
 setArguments ($arguments)
 
 getArguments ()
 
 getCallable ()
 

Protected Attributes

 $options
 
 $arguments = array()
 

Detailed Description

Represents a template function.

Use Twig_SimpleFunction instead.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com
Deprecated:
since 1.12 (to be removed in 2.0)

Definition at line 23 of file Function.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_Function::__construct ( array  $options = array())

Definition at line 28 of file Function.php.

29 {
30 $this->options = array_merge(array(
31 'needs_environment' => false,
32 'needs_context' => false,
33 'callable' => null,
34 ), $options);
35 }

References $options.

Member Function Documentation

◆ getArguments()

Twig_Function::getArguments ( )

Implements Twig_FunctionInterface.

Definition at line 42 of file Function.php.

43 {
44 return $this->arguments;
45 }

References $arguments.

◆ getCallable()

Twig_Function::getCallable ( )

Implements Twig_FunctionCallableInterface.

Definition at line 70 of file Function.php.

71 {
72 return $this->options['callable'];
73 }

◆ getSafe()

Twig_Function::getSafe ( Twig_Node  $functionArgs)

Implements Twig_FunctionInterface.

Definition at line 57 of file Function.php.

58 {
59 if (isset($this->options['is_safe'])) {
60 return $this->options['is_safe'];
61 }
62
63 if (isset($this->options['is_safe_callback'])) {
64 return call_user_func($this->options['is_safe_callback'], $functionArgs);
65 }
66
67 return array();
68 }

◆ needsContext()

Twig_Function::needsContext ( )

Implements Twig_FunctionInterface.

Definition at line 52 of file Function.php.

53 {
54 return $this->options['needs_context'];
55 }

◆ needsEnvironment()

Twig_Function::needsEnvironment ( )

Implements Twig_FunctionInterface.

Definition at line 47 of file Function.php.

48 {
49 return $this->options['needs_environment'];
50 }

◆ setArguments()

Twig_Function::setArguments (   $arguments)

Implements Twig_FunctionInterface.

Definition at line 37 of file Function.php.

38 {
39 $this->arguments = $arguments;
40 }

References $arguments.

Field Documentation

◆ $arguments

Twig_Function::$arguments = array()
protected

Definition at line 26 of file Function.php.

Referenced by getArguments(), and setArguments().

◆ $options

Twig_Function::$options
protected

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