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

Represents a template function. More...

+ Collaboration diagram for Twig_SimpleFunction:

Public Member Functions

 __construct ($name, $callable, array $options=array())
 
 getName ()
 
 getCallable ()
 
 getNodeClass ()
 
 setArguments ($arguments)
 
 getArguments ()
 
 needsEnvironment ()
 
 needsContext ()
 
 getSafe (Twig_Node $functionArgs)
 
 isVariadic ()
 
 isDeprecated ()
 
 getDeprecatedVersion ()
 
 getAlternative ()
 

Protected Attributes

 $name
 
 $callable
 
 $options
 
 $arguments = array()
 

Detailed Description

Represents a template function.

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

Definition at line 19 of file SimpleFunction.php.

Constructor & Destructor Documentation

◆ __construct()

Twig_SimpleFunction::__construct (   $name,
  $callable,
array  $options = array() 
)

Definition at line 26 of file SimpleFunction.php.

References $callable, $name, $options, and array.

27  {
28  $this->name = $name;
29  $this->callable = $callable;
30  $this->options = array_merge(array(
31  'needs_environment' => false,
32  'needs_context' => false,
33  'is_variadic' => false,
34  'is_safe' => null,
35  'is_safe_callback' => null,
36  'node_class' => 'Twig_Node_Expression_Function',
37  'deprecated' => false,
38  'alternative' => null,
39  ), $options);
40  }
Create styles array
The data for the language used.

Member Function Documentation

◆ getAlternative()

Twig_SimpleFunction::getAlternative ( )

Definition at line 105 of file SimpleFunction.php.

106  {
107  return $this->options['alternative'];
108  }

◆ getArguments()

Twig_SimpleFunction::getArguments ( )

Definition at line 62 of file SimpleFunction.php.

References $arguments.

63  {
64  return $this->arguments;
65  }

◆ getCallable()

Twig_SimpleFunction::getCallable ( )

Definition at line 47 of file SimpleFunction.php.

References $callable.

48  {
49  return $this->callable;
50  }

◆ getDeprecatedVersion()

Twig_SimpleFunction::getDeprecatedVersion ( )

Definition at line 100 of file SimpleFunction.php.

101  {
102  return $this->options['deprecated'];
103  }

◆ getName()

Twig_SimpleFunction::getName ( )

Definition at line 42 of file SimpleFunction.php.

References $name.

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

◆ getNodeClass()

Twig_SimpleFunction::getNodeClass ( )

Definition at line 52 of file SimpleFunction.php.

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

◆ getSafe()

Twig_SimpleFunction::getSafe ( Twig_Node  $functionArgs)

Definition at line 77 of file SimpleFunction.php.

References array.

78  {
79  if (null !== $this->options['is_safe']) {
80  return $this->options['is_safe'];
81  }
82 
83  if (null !== $this->options['is_safe_callback']) {
84  return call_user_func($this->options['is_safe_callback'], $functionArgs);
85  }
86 
87  return array();
88  }
Create styles array
The data for the language used.

◆ isDeprecated()

Twig_SimpleFunction::isDeprecated ( )

Definition at line 95 of file SimpleFunction.php.

96  {
97  return (bool) $this->options['deprecated'];
98  }

◆ isVariadic()

Twig_SimpleFunction::isVariadic ( )

Definition at line 90 of file SimpleFunction.php.

91  {
92  return $this->options['is_variadic'];
93  }

◆ needsContext()

Twig_SimpleFunction::needsContext ( )

Definition at line 72 of file SimpleFunction.php.

73  {
74  return $this->options['needs_context'];
75  }

◆ needsEnvironment()

Twig_SimpleFunction::needsEnvironment ( )

Definition at line 67 of file SimpleFunction.php.

68  {
69  return $this->options['needs_environment'];
70  }

◆ setArguments()

Twig_SimpleFunction::setArguments (   $arguments)

Definition at line 57 of file SimpleFunction.php.

References $arguments.

58  {
59  $this->arguments = $arguments;
60  }

Field Documentation

◆ $arguments

Twig_SimpleFunction::$arguments = array()
protected

Definition at line 24 of file SimpleFunction.php.

Referenced by getArguments(), and setArguments().

◆ $callable

Twig_SimpleFunction::$callable
protected

Definition at line 22 of file SimpleFunction.php.

Referenced by __construct(), and getCallable().

◆ $name

Twig_SimpleFunction::$name
protected

Definition at line 21 of file SimpleFunction.php.

Referenced by __construct(), and getName().

◆ $options

Twig_SimpleFunction::$options
protected

Definition at line 23 of file SimpleFunction.php.

Referenced by __construct().


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