1 | <?php |
||
34 | class RenderingContext implements RenderingContextInterface |
||
35 | { |
||
36 | /** |
||
37 | * @var ErrorHandlerInterface |
||
38 | */ |
||
39 | protected $errorHandler; |
||
40 | |||
41 | /** |
||
42 | * Template Variable Container. Contains all variables available through object accessors in the template |
||
43 | * |
||
44 | * @var VariableProviderInterface |
||
45 | */ |
||
46 | protected $variableProvider; |
||
47 | |||
48 | /** |
||
49 | * ViewHelper Variable Container |
||
50 | * |
||
51 | * @var ViewHelperVariableContainer |
||
52 | */ |
||
53 | protected $viewHelperVariableContainer; |
||
54 | |||
55 | /** |
||
56 | * @var ViewHelperResolver |
||
57 | */ |
||
58 | protected $viewHelperResolver; |
||
59 | |||
60 | /** |
||
61 | * @var ViewHelperInvoker |
||
62 | */ |
||
63 | protected $viewHelperInvoker; |
||
64 | |||
65 | /** |
||
66 | * @var TemplatePaths |
||
67 | */ |
||
68 | protected $templatePaths; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | protected $controllerName; |
||
74 | |||
75 | /** |
||
76 | * @var string |
||
77 | */ |
||
78 | protected $controllerAction; |
||
79 | |||
80 | /** |
||
81 | * @var ViewInterface |
||
82 | */ |
||
83 | protected $view; |
||
84 | |||
85 | /** |
||
86 | * @var TemplateParser |
||
87 | */ |
||
88 | protected $templateParser; |
||
89 | |||
90 | /** |
||
91 | * @var TemplateCompiler |
||
92 | */ |
||
93 | protected $templateCompiler; |
||
94 | |||
95 | /** |
||
96 | * @var FluidCacheInterface |
||
97 | */ |
||
98 | protected $cache; |
||
99 | |||
100 | /** |
||
101 | * @var TemplateProcessorInterface[] |
||
102 | */ |
||
103 | protected $templateProcessors = []; |
||
104 | |||
105 | /** |
||
106 | * List of class names implementing ExpressionNodeInterface |
||
107 | * which will be consulted when an expression does not match |
||
108 | * any built-in parser expression types. |
||
109 | * |
||
110 | * @var array |
||
111 | */ |
||
112 | protected $expressionNodeTypes = [ |
||
113 | CastingExpressionNode::class, |
||
114 | MathExpressionNode::class, |
||
115 | TernaryExpressionNode::class, |
||
116 | ]; |
||
117 | |||
118 | /** |
||
119 | * Constructor |
||
120 | * |
||
121 | * Constructing a RenderingContext should result in an object containing instances |
||
122 | * in all properties of the object. Subclassing RenderingContext allows changing the |
||
123 | * types of instances that are created. |
||
124 | * |
||
125 | * Setters are used to fill the object instances. Some setters will call the |
||
126 | * setRenderingContext() method (convention name) to provide the instance that is |
||
127 | * created with an instance of the "parent" RenderingContext. |
||
128 | */ |
||
129 | public function __construct(ViewInterface $view) |
||
147 | |||
148 | /** |
||
149 | * @return ErrorHandlerInterface |
||
150 | */ |
||
151 | public function getErrorHandler() |
||
152 | { |
||
153 | return isset($this->errorHandler) ? $this->errorHandler : new StandardErrorHandler(); |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * @param ErrorHandlerInterface $errorHandler |
||
158 | * @return void |
||
159 | */ |
||
160 | public function setErrorHandler(ErrorHandlerInterface $errorHandler) |
||
164 | |||
165 | /** |
||
166 | * Injects the template variable container containing all variables available through ObjectAccessors |
||
167 | * in the template |
||
168 | * |
||
169 | * @param VariableProviderInterface $variableProvider The template variable container to set |
||
170 | */ |
||
171 | public function setVariableProvider(VariableProviderInterface $variableProvider) |
||
175 | |||
176 | /** |
||
177 | * Get the template variable container |
||
178 | * |
||
179 | * @return VariableProviderInterface The Template Variable Container |
||
180 | */ |
||
181 | public function getVariableProvider() |
||
185 | |||
186 | /** |
||
187 | * @return ViewHelperResolver |
||
188 | */ |
||
189 | public function getViewHelperResolver() |
||
193 | |||
194 | /** |
||
195 | * @param ViewHelperResolver $viewHelperResolver |
||
196 | * @return void |
||
197 | */ |
||
198 | public function setViewHelperResolver(ViewHelperResolver $viewHelperResolver) |
||
202 | |||
203 | /** |
||
204 | * @return ViewHelperInvoker |
||
205 | */ |
||
206 | public function getViewHelperInvoker() |
||
210 | |||
211 | /** |
||
212 | * @param ViewHelperInvoker $viewHelperInvoker |
||
213 | * @return void |
||
214 | */ |
||
215 | public function setViewHelperInvoker(ViewHelperInvoker $viewHelperInvoker) |
||
219 | |||
220 | /** |
||
221 | * @return TemplatePaths |
||
222 | */ |
||
223 | public function getTemplatePaths() |
||
227 | |||
228 | /** |
||
229 | * @param TemplatePaths $templatePaths |
||
230 | * @return void |
||
231 | */ |
||
232 | public function setTemplatePaths(TemplatePaths $templatePaths) |
||
236 | |||
237 | /** |
||
238 | * Set the ViewHelperVariableContainer |
||
239 | * |
||
240 | * @param ViewHelperVariableContainer $viewHelperVariableContainer |
||
241 | * @return void |
||
242 | */ |
||
243 | public function setViewHelperVariableContainer(ViewHelperVariableContainer $viewHelperVariableContainer) |
||
247 | |||
248 | /** |
||
249 | * Get the ViewHelperVariableContainer |
||
250 | * |
||
251 | * @return ViewHelperVariableContainer |
||
252 | */ |
||
253 | public function getViewHelperVariableContainer() |
||
257 | |||
258 | /** |
||
259 | * Inject the Template Parser |
||
260 | * |
||
261 | * @param TemplateParser $templateParser The template parser |
||
262 | * @return void |
||
263 | */ |
||
264 | public function setTemplateParser(TemplateParser $templateParser) |
||
269 | |||
270 | /** |
||
271 | * @return TemplateParser |
||
272 | */ |
||
273 | public function getTemplateParser() |
||
277 | |||
278 | /** |
||
279 | * @param TemplateCompiler $templateCompiler |
||
280 | * @return void |
||
281 | */ |
||
282 | public function setTemplateCompiler(TemplateCompiler $templateCompiler) |
||
287 | |||
288 | /** |
||
289 | * @return TemplateCompiler |
||
290 | */ |
||
291 | public function getTemplateCompiler() |
||
295 | |||
296 | /** |
||
297 | * Delegation: Set the cache used by this View's compiler |
||
298 | * |
||
299 | * @param FluidCacheInterface $cache |
||
300 | * @return void |
||
301 | */ |
||
302 | public function setCache(FluidCacheInterface $cache) |
||
306 | |||
307 | /** |
||
308 | * @return FluidCacheInterface |
||
309 | */ |
||
310 | public function getCache() |
||
314 | |||
315 | /** |
||
316 | * @return boolean |
||
317 | */ |
||
318 | public function isCacheEnabled() |
||
322 | |||
323 | /** |
||
324 | * Delegation: Set TemplateProcessor instances in the parser |
||
325 | * through a public API. |
||
326 | * |
||
327 | * @param TemplateProcessorInterface[] $templateProcessors |
||
328 | * @return void |
||
329 | */ |
||
330 | public function setTemplateProcessors(array $templateProcessors) |
||
337 | |||
338 | /** |
||
339 | * @return TemplateProcessorInterface[] |
||
340 | */ |
||
341 | public function getTemplateProcessors() |
||
345 | |||
346 | /** |
||
347 | * @return string |
||
348 | */ |
||
349 | public function getExpressionNodeTypes() |
||
353 | |||
354 | /** |
||
355 | * @param array $expressionNodeTypes |
||
356 | * @return void |
||
357 | */ |
||
358 | public function setExpressionNodeTypes(array $expressionNodeTypes) |
||
362 | |||
363 | /** |
||
364 | * Build parser configuration |
||
365 | * |
||
366 | * @return Configuration |
||
367 | */ |
||
368 | public function buildParserConfiguration() |
||
375 | |||
376 | /** |
||
377 | * @return string |
||
378 | */ |
||
379 | public function getControllerName() |
||
383 | |||
384 | /** |
||
385 | * @param string $controllerName |
||
386 | * @return void |
||
387 | */ |
||
388 | public function setControllerName($controllerName) |
||
392 | |||
393 | /** |
||
394 | * @return string |
||
395 | */ |
||
396 | public function getControllerAction() |
||
400 | |||
401 | /** |
||
402 | * @param string $action |
||
403 | * @return void |
||
404 | */ |
||
405 | public function setControllerAction($action) |
||
409 | } |
||
410 |