Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
StagingExtension.php
001 <?php
002
003 /*
004 * This file is part of Twig.
005 *
006 * (c) Fabien Potencier
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Twig\Extension;
013
014 use Twig\NodeVisitor\NodeVisitorInterface;
015 use Twig\TokenParser\TokenParserInterface;
016 use Twig\TwigFilter;
017 use Twig\TwigFunction;
018 use Twig\TwigTest;
019
020 /**
021 * Used by \Twig\Environment as a staging area.
022 *
023 * @author Fabien Potencier <fabien@symfony.com>
024 *
025 * @internal
026 */
027 final class StagingExtension extends AbstractExtension
028 {
029 private $functions = [];
030 private $filters = [];
031 private $visitors = [];
032 private $tokenParsers = [];
033 private $tests = [];
034
035 public function addFunction(TwigFunction $function)
036 {
037 if (isset($this->functions[$function->getName()])) {
038 throw new \LogicException(sprintf('Function "%s" is already registered.', $function->getName()));
039 }
040
041 $this->functions[$function->getName()] = $function;
042 }
043
044 public function getFunctions()
045 {
046 return $this->functions;
047 }
048
049 public function addFilter(TwigFilter $filter)
050 {
051 if (isset($this->filters[$filter->getName()])) {
052 throw new \LogicException(sprintf('Filter "%s" is already registered.', $filter->getName()));
053 }
054
055 $this->filters[$filter->getName()] = $filter;
056 }
057
058 public function getFilters()
059 {
060 return $this->filters;
061 }
062
063 public function addNodeVisitor(NodeVisitorInterface $visitor)
064 {
065 $this->visitors[] = $visitor;
066 }
067
068 public function getNodeVisitors()
069 {
070 return $this->visitors;
071 }
072
073 public function addTokenParser(TokenParserInterface $parser)
074 {
075 if (isset($this->tokenParsers[$parser->getTag()])) {
076 throw new \LogicException(sprintf('Tag "%s" is already registered.', $parser->getTag()));
077 }
078
079 $this->tokenParsers[$parser->getTag()] = $parser;
080 }
081
082 public function getTokenParsers()
083 {
084 return $this->tokenParsers;
085 }
086
087 public function addTest(TwigTest $test)
088 {
089 if (isset($this->tests[$test->getName()])) {
090 throw new \LogicException(sprintf('Test "%s" is already registered.', $test->getName()));
091 }
092
093 $this->tests[$test->getName()] = $test;
094 }
095
096 public function getTests()
097 {
098 return $this->tests;
099 }
100 }
101
102 class_alias('Twig\Extension\StagingExtension', 'Twig_Extension_Staging');
103