]>
git.immae.eu Git - github/wallabag/wallabag.git/blob - inc/3rdparty/Twig/SimpleFilter.php
4 * This file is part of Twig.
6 * (c) 2009-2012 Fabien Potencier
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
13 * Represents a template filter.
15 * @author Fabien Potencier <fabien@symfony.com>
17 class Twig_SimpleFilter
22 protected $arguments = array();
24 public function __construct($name, $callable, array $options = array())
27 $this->callable
= $callable;
28 $this->options
= array_merge(array(
29 'needs_environment' => false,
30 'needs_context' => false,
32 'is_safe_callback' => null,
34 'preserves_safety' => null,
35 'node_class' => 'Twig_Node_Expression_Filter',
39 public function getName()
44 public function getCallable()
46 return $this->callable
;
49 public function getNodeClass()
51 return $this->options
['node_class'];
54 public function setArguments($arguments)
56 $this->arguments
= $arguments;
59 public function getArguments()
61 return $this->arguments
;
64 public function needsEnvironment()
66 return $this->options
['needs_environment'];
69 public function needsContext()
71 return $this->options
['needs_context'];
74 public function getSafe(Twig_Node
$filterArgs)
76 if (null !== $this->options
['is_safe']) {
77 return $this->options
['is_safe'];
80 if (null !== $this->options
['is_safe_callback']) {
81 return call_user_func($this->options
['is_safe_callback'], $filterArgs);
85 public function getPreservesSafety()
87 return $this->options
['preserves_safety'];
90 public function getPreEscape()
92 return $this->options
['pre_escape'];