35 return dirname(__FILE__).
'/Fixtures/';
51 public function bar($param1 =
null, $param2 =
null)
53 return 'bar'.($param1 ?
'_'.$param1 :
'').($param2 ?
'-'.$param2 :
'');
83 return strtolower($value);
108 return isset($this->array[$this->position]);
140 new Twig_SimpleFilter(
'escape_and_nl2br', array($this,
'escape_and_nl2br'), array(
'needs_environment' =>
true,
'is_safe' => array(
'html'))),
141 new Twig_SimpleFilter(
'nl2br', array($this,
'nl2br'), array(
'pre_escape' =>
'html',
'is_safe' => array(
'html'))),
142 new Twig_SimpleFilter(
'escape_something', array($this,
'escape_something'), array(
'is_safe' => array(
'something'))),
143 new Twig_SimpleFilter(
'preserves_safety', array($this,
'preserves_safety'), array(
'preserves_safety' => array(
'html'))),
145 new Twig_SimpleFilter(
'static_call_array', array(
'TwigTestExtension',
'staticCall')),
147 new Twig_SimpleFilter(
'magic_call_string',
'TwigTestExtension::magicStaticCall'),
148 new Twig_SimpleFilter(
'magic_call_array', array(
'TwigTestExtension',
'magicStaticCall')),
189 return $this->
nl2br(twig_escape_filter(
$env, $value,
'html'), $sep);
195 public function nl2br($value, $sep =
'<br />')
199 return str_replace(
"\n",
"$sep\n", $value);
204 return $element.
'/'.$item;
209 return $foo.
'/'.$bar.
'/'.$item;
214 return strtoupper($value);
219 return strtoupper($value);
234 return false !== strpos($value,
' ');
237 public function __call($method, $arguments)
239 if (
'magicCall' !== $method) {
240 throw new BadMethodCallException(
'Unexpected call to __call');
243 return 'magic_'.$arguments[0];
248 if (
'magicStaticCall' !== $method) {
249 throw new BadMethodCallException(
'Unexpected call to __callStatic');
252 return 'static_magic_'.$arguments[0];
264 throw new Exception(
'__call shall not be called');
307 throw new Exception(
'__toString shall not be called on \Countables');
325 return new ArrayIterator($this->
data);
An exception for terminatinating execution or to throw for unit testing.
This class is used in tests for the length filter and empty test to show that when \Countable is impl...
This class is used in tests for the length filter.
This class is used in tests for the "length" filter and "empty" test.
static staticCall($value)
static __callStatic($method, $arguments)
nl2br($value, $sep='< br/>')
nl2br only, for testing filters with pre_escape.
escape_and_nl2br($env, $value, $sep='< br/>')
nl2br which also escapes, for testing escaper filters.
getTokenParsers()
Returns the token parser instances to add to the existing list.
dynamic_foo($foo, $bar, $item)
__call($method, $arguments)
getFilters()
Returns a list of filters to add to the existing list.
getFunctions()
Returns a list of functions to add to the existing list.
getTests()
Returns a list of tests to add to the existing list.
dynamic_path($element, $item)
bar($param1=null, $param2=null)
parse(Twig_Token $token)
Parses a token and returns a node.
getTag()
Gets the tag name associated with this token parser.
Represents a node that outputs an expression.
Represents a security policy which need to be enforced when sandbox mode is enabled.
Represents a template filter.
Represents a template function.
Represents a template test.
Base class for all token parsers.