composer package updates
[openemr.git] / vendor / twig / twig / lib / Twig / Extension / Staging.php
blobd3a0f9c946daf0800a1e6f892c5e4136d23f9804
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 /**
13 * Internal class.
15 * This class is used by Twig_Environment as a staging area and must not be used directly.
17 * @author Fabien Potencier <fabien@symfony.com>
19 * @internal
21 class Twig_Extension_Staging extends Twig_Extension
23 protected $functions = array();
24 protected $filters = array();
25 protected $visitors = array();
26 protected $tokenParsers = array();
27 protected $globals = array();
28 protected $tests = array();
30 public function addFunction($name, $function)
32 if (isset($this->functions[$name])) {
33 @trigger_error(sprintf('Overriding function "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
36 $this->functions[$name] = $function;
39 public function getFunctions()
41 return $this->functions;
44 public function addFilter($name, $filter)
46 if (isset($this->filters[$name])) {
47 @trigger_error(sprintf('Overriding filter "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
50 $this->filters[$name] = $filter;
53 public function getFilters()
55 return $this->filters;
58 public function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
60 $this->visitors[] = $visitor;
63 public function getNodeVisitors()
65 return $this->visitors;
68 public function addTokenParser(Twig_TokenParserInterface $parser)
70 if (isset($this->tokenParsers[$parser->getTag()])) {
71 @trigger_error(sprintf('Overriding tag "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $parser->getTag()), E_USER_DEPRECATED);
74 $this->tokenParsers[$parser->getTag()] = $parser;
77 public function getTokenParsers()
79 return $this->tokenParsers;
82 public function addGlobal($name, $value)
84 $this->globals[$name] = $value;
87 public function getGlobals()
89 return $this->globals;
92 public function addTest($name, $test)
94 if (isset($this->tests[$name])) {
95 @trigger_error(sprintf('Overriding test "%s" that is already registered is deprecated since version 1.30 and won\'t be possible anymore in 2.0.', $name), E_USER_DEPRECATED);
98 $this->tests[$name] = $test;
101 public function getTests()
103 return $this->tests;
106 public function getName()
108 return 'staging';
112 class_alias('Twig_Extension_Staging', 'Twig\Extension\StagingExtension', false);