composer package updates
[openemr.git] / vendor / twig / twig / lib / Twig / Filter.php
blob893d75d103fc6e7e3a1161d88c7dd32e2645645b
1 <?php
3 /*
4 * This file is part of Twig.
6 * (c) Fabien Potencier
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 @trigger_error('The Twig_Filter class is deprecated since version 1.12 and will be removed in 2.0. Use Twig_SimpleFilter instead.', E_USER_DEPRECATED);
14 /**
15 * Represents a template filter.
17 * Use Twig_SimpleFilter instead.
19 * @author Fabien Potencier <fabien@symfony.com>
21 * @deprecated since 1.12 (to be removed in 2.0)
23 abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface
25 protected $options;
26 protected $arguments = array();
28 public function __construct(array $options = array())
30 $this->options = array_merge(array(
31 'needs_environment' => false,
32 'needs_context' => false,
33 'pre_escape' => null,
34 'preserves_safety' => null,
35 'callable' => null,
36 ), $options);
39 public function setArguments($arguments)
41 $this->arguments = $arguments;
44 public function getArguments()
46 return $this->arguments;
49 public function needsEnvironment()
51 return $this->options['needs_environment'];
54 public function needsContext()
56 return $this->options['needs_context'];
59 public function getSafe(Twig_Node $filterArgs)
61 if (isset($this->options['is_safe'])) {
62 return $this->options['is_safe'];
65 if (isset($this->options['is_safe_callback'])) {
66 return call_user_func($this->options['is_safe_callback'], $filterArgs);
70 public function getPreservesSafety()
72 return $this->options['preserves_safety'];
75 public function getPreEscape()
77 return $this->options['pre_escape'];
80 public function getCallable()
82 return $this->options['callable'];