wb-archiv283/branches/2.8.x/wb/include/Sensio/Twig/lib/Twig/Extension/Staging.php @ 1958
1 |
<?php
|
---|---|
2 |
|
3 |
/*
|
4 |
* This file is part of Twig.
|
5 |
*
|
6 |
* (c) 2012 Fabien Potencier
|
7 |
*
|
8 |
* For the full copyright and license information, please view the LICENSE
|
9 |
* file that was distributed with this source code.
|
10 |
*/
|
11 |
|
12 |
/**
|
13 |
* Internal class.
|
14 |
*
|
15 |
* This class is used by Twig_Environment as a staging area and must not be used directly.
|
16 |
*
|
17 |
* @author Fabien Potencier <fabien@symfony.com>
|
18 |
*/
|
19 |
class Twig_Extension_Staging extends Twig_Extension |
20 |
{
|
21 |
protected $functions = array(); |
22 |
protected $filters = array(); |
23 |
protected $visitors = array(); |
24 |
protected $tokenParsers = array(); |
25 |
protected $globals = array(); |
26 |
protected $tests = array(); |
27 |
|
28 |
public function addFunction($name, $function) |
29 |
{
|
30 |
$this->functions[$name] = $function; |
31 |
}
|
32 |
|
33 |
/**
|
34 |
* {@inheritdoc}
|
35 |
*/
|
36 |
public function getFunctions() |
37 |
{
|
38 |
return $this->functions; |
39 |
}
|
40 |
|
41 |
public function addFilter($name, $filter) |
42 |
{
|
43 |
$this->filters[$name] = $filter; |
44 |
}
|
45 |
|
46 |
/**
|
47 |
* {@inheritdoc}
|
48 |
*/
|
49 |
public function getFilters() |
50 |
{
|
51 |
return $this->filters; |
52 |
}
|
53 |
|
54 |
public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) |
55 |
{
|
56 |
$this->visitors[] = $visitor; |
57 |
}
|
58 |
|
59 |
/**
|
60 |
* {@inheritdoc}
|
61 |
*/
|
62 |
public function getNodeVisitors() |
63 |
{
|
64 |
return $this->visitors; |
65 |
}
|
66 |
|
67 |
public function addTokenParser(Twig_TokenParserInterface $parser) |
68 |
{
|
69 |
$this->tokenParsers[] = $parser; |
70 |
}
|
71 |
|
72 |
/**
|
73 |
* {@inheritdoc}
|
74 |
*/
|
75 |
public function getTokenParsers() |
76 |
{
|
77 |
return $this->tokenParsers; |
78 |
}
|
79 |
|
80 |
public function addGlobal($name, $value) |
81 |
{
|
82 |
$this->globals[$name] = $value; |
83 |
}
|
84 |
|
85 |
/**
|
86 |
* {@inheritdoc}
|
87 |
*/
|
88 |
public function getGlobals() |
89 |
{
|
90 |
return $this->globals; |
91 |
}
|
92 |
|
93 |
public function addTest($name, $test) |
94 |
{
|
95 |
$this->tests[$name] = $test; |
96 |
}
|
97 |
|
98 |
/**
|
99 |
* {@inheritdoc}
|
100 |
*/
|
101 |
public function getTests() |
102 |
{
|
103 |
return $this->tests; |
104 |
}
|
105 |
|
106 |
/**
|
107 |
* {@inheritdoc}
|
108 |
*/
|
109 |
public function getName() |
110 |
{
|
111 |
return 'staging'; |
112 |
}
|
113 |
}
|