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

Represents a template filter. More...

+ Collaboration diagram for Twig_SimpleFilter:

Public Member Functions

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

Protected Attributes

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

Detailed Description

Represents a template filter.

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

Definition at line 19 of file SimpleFilter.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 26 of file SimpleFilter.php.

References $callable, $name, and $options.

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  'pre_escape' => null,
37  'preserves_safety' => null,
38  'node_class' => 'Twig_Node_Expression_Filter',
39  'deprecated' => false,
40  'alternative' => null,
41  ), $options);
42  }

Member Function Documentation

◆ getAlternative()

Twig_SimpleFilter::getAlternative ( )

Definition at line 115 of file SimpleFilter.php.

116  {
117  return $this->options['alternative'];
118  }

◆ getArguments()

Twig_SimpleFilter::getArguments ( )

Definition at line 64 of file SimpleFilter.php.

References $arguments.

65  {
66  return $this->arguments;
67  }

◆ getCallable()

Twig_SimpleFilter::getCallable ( )

Definition at line 49 of file SimpleFilter.php.

References $callable.

50  {
51  return $this->callable;
52  }

◆ getDeprecatedVersion()

Twig_SimpleFilter::getDeprecatedVersion ( )

Definition at line 110 of file SimpleFilter.php.

111  {
112  return $this->options['deprecated'];
113  }

◆ getName()

Twig_SimpleFilter::getName ( )

Definition at line 44 of file SimpleFilter.php.

References $name.

45  {
46  return $this->name;
47  }

◆ getNodeClass()

Twig_SimpleFilter::getNodeClass ( )

Definition at line 54 of file SimpleFilter.php.

55  {
56  return $this->options['node_class'];
57  }

◆ getPreEscape()

Twig_SimpleFilter::getPreEscape ( )

Definition at line 95 of file SimpleFilter.php.

96  {
97  return $this->options['pre_escape'];
98  }

◆ getPreservesSafety()

Twig_SimpleFilter::getPreservesSafety ( )

Definition at line 90 of file SimpleFilter.php.

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

◆ getSafe()

Twig_SimpleFilter::getSafe ( Twig_Node  $filterArgs)

Definition at line 79 of file SimpleFilter.php.

80  {
81  if (null !== $this->options['is_safe']) {
82  return $this->options['is_safe'];
83  }
84 
85  if (null !== $this->options['is_safe_callback']) {
86  return call_user_func($this->options['is_safe_callback'], $filterArgs);
87  }
88  }

◆ isDeprecated()

Twig_SimpleFilter::isDeprecated ( )

Definition at line 105 of file SimpleFilter.php.

Referenced by Twig_ExpressionParser\getFilterNodeClass().

106  {
107  return (bool) $this->options['deprecated'];
108  }
+ Here is the caller graph for this function:

◆ isVariadic()

Twig_SimpleFilter::isVariadic ( )

Definition at line 100 of file SimpleFilter.php.

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

◆ needsContext()

Twig_SimpleFilter::needsContext ( )

Definition at line 74 of file SimpleFilter.php.

75  {
76  return $this->options['needs_context'];
77  }

◆ needsEnvironment()

Twig_SimpleFilter::needsEnvironment ( )

Definition at line 69 of file SimpleFilter.php.

70  {
71  return $this->options['needs_environment'];
72  }

◆ setArguments()

Twig_SimpleFilter::setArguments (   $arguments)

Definition at line 59 of file SimpleFilter.php.

References $arguments.

60  {
61  $this->arguments = $arguments;
62  }

Field Documentation

◆ $arguments

Twig_SimpleFilter::$arguments = array()
protected

Definition at line 24 of file SimpleFilter.php.

Referenced by getArguments(), and setArguments().

◆ $callable

Twig_SimpleFilter::$callable
protected

Definition at line 22 of file SimpleFilter.php.

Referenced by __construct(), and getCallable().

◆ $name

Twig_SimpleFilter::$name
protected

Definition at line 21 of file SimpleFilter.php.

Referenced by __construct(), and getName().

◆ $options

Twig_SimpleFilter::$options
protected

Definition at line 23 of file SimpleFilter.php.

Referenced by __construct().


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