1 | <?php |
||
25 | class TagcommanderExtension extends \Twig_Extension |
||
26 | { |
||
27 | /** |
||
28 | * @var ParameterBagInterface |
||
29 | */ |
||
30 | protected $datalayer; |
||
31 | |||
32 | /** |
||
33 | * @var EventDispatcherInterface |
||
34 | */ |
||
35 | protected $dispatcher; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $tcVars; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $events = array(); |
||
46 | |||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $containers = array(); |
||
51 | |||
52 | /** |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $defaultEvent = null; |
||
56 | |||
57 | /** |
||
58 | * @var Serializer |
||
59 | */ |
||
60 | protected $serializer; |
||
61 | |||
62 | /** |
||
63 | * @var array |
||
64 | */ |
||
65 | static protected $twigFunctions = array( |
||
66 | 'tc_vars' => 'tcVars', |
||
67 | 'tc_container' => 'tcContainer', |
||
68 | 'tc_event' => 'tcEvent', |
||
69 | ); |
||
70 | |||
71 | /** |
||
72 | * @param ParameterBagInterface $datalayer |
||
73 | * @param EventDispatcherInterface $dispatcher |
||
74 | * @param string $tcVars |
||
75 | */ |
||
76 | 1 | public function __construct( |
|
89 | |||
90 | /** |
||
91 | * @return string|boolean|integer|double|null |
||
92 | */ |
||
93 | 1 | protected function serializeWithValues($values = array()) |
|
108 | |||
109 | /** |
||
110 | * @param Array $values |
||
111 | * @return string |
||
112 | */ |
||
113 | 1 | public function tcVars($values = array()) |
|
121 | |||
122 | /** |
||
123 | * @param array $event |
||
124 | * @param boolean $setAsDefault |
||
125 | * @return self |
||
126 | */ |
||
127 | 1 | public function addEvent($event, $setAsDefault = false) |
|
137 | |||
138 | /** |
||
139 | * @param string $eventName |
||
140 | * @param array $values |
||
141 | * @param string|null $tracker |
||
142 | * @return string |
||
143 | */ |
||
144 | 1 | public function tcEvent($eventName, $values = array(), $tracker = null) |
|
162 | |||
163 | /** |
||
164 | * @param array $container |
||
165 | * @return self |
||
166 | */ |
||
167 | 1 | public function addContainer($container) |
|
173 | |||
174 | 1 | private function containerHas($container, $parameterName) |
|
178 | |||
179 | 1 | private function buildSrc($container) |
|
187 | |||
188 | 1 | private function buildAlternative($container) |
|
200 | |||
201 | /** |
||
202 | * @param string $containerName |
||
203 | * @return string |
||
204 | 1 | */ |
|
205 | public function tcContainer($containerName) |
||
224 | |||
225 | /** |
||
226 | * @param string $twigName |
||
227 | * @param string $methodName |
||
228 | * @return \Twig_SimpleFunction |
||
229 | 1 | */ |
|
230 | private function makeFunction($twigName, $methodName) |
||
240 | |||
241 | /** |
||
242 | * @return \Twig_SimpleFunction[] |
||
243 | 1 | */ |
|
244 | public function getFunctions() |
||
252 | |||
253 | /** |
||
254 | * @return string |
||
255 | 1 | */ |
|
256 | public function getName() |
||
260 | } |
||
261 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.