1 | <?php |
||
20 | class Container |
||
21 | { |
||
22 | // The Dependency Injection Container |
||
23 | private $di = null; |
||
24 | |||
25 | // The only instance of the Container (Singleton) |
||
26 | private static $xInstance = null; |
||
27 | |||
28 | public static function getInstance() |
||
36 | |||
37 | private function __construct() |
||
45 | |||
46 | /** |
||
47 | * Set the parameters and create the objects in the dependency injection container |
||
48 | * |
||
49 | * @param string $sTranslationDir The translation directory |
||
50 | * @param string $sTemplateDir The template directory |
||
51 | * |
||
52 | * @return void |
||
53 | */ |
||
54 | private function init($sTranslationDir, $sTemplateDir) |
||
138 | |||
139 | /** |
||
140 | * Get a class instance |
||
141 | * |
||
142 | * @return object The class instance |
||
143 | */ |
||
144 | public function get($sClass) |
||
148 | |||
149 | /** |
||
150 | * Set a DI closure |
||
151 | * |
||
152 | * @param string $sClass The full class name |
||
153 | * @param Closure $xClosure The closure |
||
154 | * |
||
155 | * @return void |
||
156 | */ |
||
157 | public function set($sClass, $xClosure) |
||
161 | |||
162 | /** |
||
163 | * Get the plugin manager |
||
164 | * |
||
165 | * @return object The plugin manager |
||
166 | */ |
||
167 | public function getPluginManager() |
||
171 | |||
172 | /** |
||
173 | * Get the request manager |
||
174 | * |
||
175 | * @return object The request manager |
||
176 | */ |
||
177 | public function getRequestManager() |
||
181 | |||
182 | /** |
||
183 | * Get the request factory |
||
184 | * |
||
185 | * @return object The request factory |
||
186 | */ |
||
187 | public function getRequestFactory() |
||
191 | |||
192 | /** |
||
193 | * Get the response manager |
||
194 | * |
||
195 | * @return object The response manager |
||
196 | */ |
||
197 | public function getResponseManager() |
||
201 | |||
202 | /** |
||
203 | * Get the config manager |
||
204 | * |
||
205 | * @return Jaxon\Utils\Config\Config The config manager |
||
206 | */ |
||
207 | public function getConfig() |
||
211 | |||
212 | /** |
||
213 | * Create a new the config manager |
||
214 | * |
||
215 | * @return Jaxon\Utils\Config\Config The config manager |
||
216 | */ |
||
217 | public function newConfig() |
||
221 | |||
222 | /** |
||
223 | * Get the minifier |
||
224 | * |
||
225 | * @return object The minifier |
||
226 | */ |
||
227 | public function getMinifier() |
||
231 | |||
232 | /** |
||
233 | * Get the translator |
||
234 | * |
||
235 | * @return object The translator |
||
236 | */ |
||
237 | public function getTranslator() |
||
241 | |||
242 | /** |
||
243 | * Get the template engine |
||
244 | * |
||
245 | * @return object The template engine |
||
246 | */ |
||
247 | public function getTemplate() |
||
251 | |||
252 | /** |
||
253 | * Get the validator |
||
254 | * |
||
255 | * @return object The validator |
||
256 | */ |
||
257 | public function getValidator() |
||
261 | |||
262 | /** |
||
263 | * Get the paginator |
||
264 | * |
||
265 | * @return object The paginator |
||
266 | */ |
||
267 | public function getPaginator() |
||
271 | |||
272 | /** |
||
273 | * Set the pagination renderer |
||
274 | * |
||
275 | * @param object $xRenderer The pagination renderer |
||
276 | * |
||
277 | * @return void |
||
278 | */ |
||
279 | public function setPaginationRenderer($xRenderer) |
||
283 | |||
284 | /** |
||
285 | * Get the event dispatcher |
||
286 | * |
||
287 | * @return object The event dispatcher |
||
288 | */ |
||
289 | public function getEventDispatcher() |
||
293 | |||
294 | /** |
||
295 | * Get the Global Response object |
||
296 | * |
||
297 | * @return object The Global Response object |
||
298 | */ |
||
299 | public function getResponse() |
||
303 | |||
304 | /** |
||
305 | * Create a new Jaxon response object |
||
306 | * |
||
307 | * @return \Jaxon\Response\Response The new Jaxon response object |
||
308 | */ |
||
309 | public function newResponse() |
||
313 | |||
314 | /** |
||
315 | * Get the main Jaxon object |
||
316 | * |
||
317 | * @return object The Jaxon object |
||
318 | */ |
||
319 | public function getJaxon() |
||
323 | |||
324 | /** |
||
325 | * Get the Jaxon library version number |
||
326 | * |
||
327 | * @return string The version number |
||
328 | */ |
||
329 | public function getVersion() |
||
333 | |||
334 | /** |
||
335 | * Get the Sentry instance |
||
336 | * |
||
337 | * @return object The Sentry instance |
||
338 | */ |
||
339 | public function getSentry() |
||
343 | |||
344 | /** |
||
345 | * Set the Sentry instance |
||
346 | * |
||
347 | * @param object $xSentry The Sentry instance |
||
348 | * |
||
349 | * @return void |
||
350 | */ |
||
351 | public function setSentry($xSentry) |
||
355 | |||
356 | /** |
||
357 | * Get the Armada instance |
||
358 | * |
||
359 | * @return object The Armada instance |
||
360 | */ |
||
361 | public function getArmada() |
||
365 | |||
366 | /** |
||
367 | * Set the Armada instance |
||
368 | * |
||
369 | * @param object $xArmada The Armada instance |
||
370 | * |
||
371 | * @return void |
||
372 | */ |
||
373 | public function setArmada($xArmada) |
||
377 | |||
378 | /** |
||
379 | * Set the view renderers data |
||
380 | * |
||
381 | * @param array $aRenderers Array of renderer names with namespace as key |
||
382 | * |
||
383 | * @return void |
||
384 | */ |
||
385 | public function initViewRenderers($aRenderers) |
||
389 | |||
390 | /** |
||
391 | * Set the view namespaces data |
||
392 | * |
||
393 | * @param array $aNamespaces Array of namespaces with renderer name as key |
||
394 | * |
||
395 | * @return void |
||
396 | */ |
||
397 | public function initViewNamespaces($aNamespaces, $sDefaultNamespace) |
||
402 | |||
403 | /** |
||
404 | * Add a view renderer |
||
405 | * |
||
406 | * @param string $sId The unique identifier of the view renderer |
||
407 | * @param Closure $xClosure A closure to create the view instance |
||
408 | * |
||
409 | * @return void |
||
410 | */ |
||
411 | public function addViewRenderer($sId, $xClosure) |
||
432 | |||
433 | /** |
||
434 | * Get the view object |
||
435 | * |
||
436 | * @param string $sId The unique identifier of the view renderer |
||
437 | * |
||
438 | * @return object The view object |
||
439 | */ |
||
440 | public function getViewRenderer($sId = '') |
||
450 | |||
451 | /** |
||
452 | * Get the session object |
||
453 | * |
||
454 | * @return object The session object |
||
455 | */ |
||
456 | public function getSessionManager() |
||
460 | |||
461 | /** |
||
462 | * Set the session |
||
463 | * |
||
464 | * @param Closure $xClosure A closure to create the session instance |
||
465 | * |
||
466 | * @return void |
||
467 | */ |
||
468 | public function setSessionManager($xClosure) |
||
472 | } |
||
473 |