1 | <?php |
||
59 | class Container |
||
60 | { |
||
61 | /** |
||
62 | * The Dependency Injection Container |
||
63 | * |
||
64 | * @var \Pimple\Container |
||
65 | */ |
||
66 | private $libContainer = null; |
||
67 | |||
68 | /** |
||
69 | * The Dependency Injection Container |
||
70 | * |
||
71 | * @var \Jaxon\Contracts\Container |
||
72 | */ |
||
73 | private $appContainer = null; |
||
74 | |||
75 | /** |
||
76 | * The class constructor |
||
77 | */ |
||
78 | public function __construct() |
||
86 | |||
87 | /** |
||
88 | * Get the container provided by the integrated framework |
||
89 | * |
||
90 | * @return ContainerContract |
||
91 | */ |
||
92 | public function getAppContainer() |
||
96 | |||
97 | /** |
||
98 | * Set the container provided by the integrated framework |
||
99 | * |
||
100 | * @param ContainerContract $container The container implementation |
||
101 | * |
||
102 | * @return void |
||
103 | */ |
||
104 | public function setAppContainer(ContainerContract $container) |
||
108 | |||
109 | /** |
||
110 | * Set the parameters and create the objects in the dependency injection container |
||
111 | * |
||
112 | * @param string $sTranslationDir The translation directory |
||
113 | * @param string $sTemplateDir The template directory |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | private function init($sTranslationDir, $sTemplateDir) |
||
269 | |||
270 | /** |
||
271 | * Get a class instance |
||
272 | * |
||
273 | * @return object The class instance |
||
274 | */ |
||
275 | public function get($sClass) |
||
283 | |||
284 | /** |
||
285 | * Set a DI closure |
||
286 | * |
||
287 | * @param string $sClass The full class name |
||
288 | * @param Closure $xClosure The closure |
||
289 | * |
||
290 | * @return void |
||
291 | */ |
||
292 | public function set($sClass, Closure $xClosure) |
||
296 | |||
297 | /** |
||
298 | * Set an alias |
||
299 | * |
||
300 | * @param string $sClass The class name |
||
301 | * @param string $sAlias The alias name |
||
302 | * |
||
303 | * @return void |
||
304 | */ |
||
305 | public function alias($sClass, $sAlias) |
||
311 | |||
312 | /** |
||
313 | * Get the plugin manager |
||
314 | * |
||
315 | * @return PluginManager |
||
316 | */ |
||
317 | public function getPluginManager() |
||
321 | |||
322 | /** |
||
323 | * Get the request handler |
||
324 | * |
||
325 | * @return RequestHandler |
||
326 | */ |
||
327 | public function getRequestHandler() |
||
331 | |||
332 | /** |
||
333 | * Get the request factory |
||
334 | * |
||
335 | * @return RequestFactory |
||
336 | */ |
||
337 | public function getRequestFactory() |
||
341 | |||
342 | /** |
||
343 | * Get the parameter factory |
||
344 | * |
||
345 | * @return ParameterFactory |
||
346 | */ |
||
347 | public function getParameterFactory() |
||
351 | |||
352 | /** |
||
353 | * Get the response manager |
||
354 | * |
||
355 | * @return ResponseManager |
||
356 | */ |
||
357 | public function getResponseManager() |
||
361 | |||
362 | /** |
||
363 | * Get the code generator |
||
364 | * |
||
365 | * @return CodeGenerator |
||
366 | */ |
||
367 | public function getCodeGenerator() |
||
371 | |||
372 | /** |
||
373 | * Get the callable registry |
||
374 | * |
||
375 | * @return CallableRegistry |
||
376 | */ |
||
377 | public function getCallableRegistry() |
||
378 | { |
||
379 | return $this->libContainer[CallableRegistry::class]; |
||
380 | } |
||
381 | |||
382 | /** |
||
383 | * Get the config manager |
||
384 | * |
||
385 | * @return Config |
||
386 | */ |
||
387 | public function getConfig() |
||
391 | |||
392 | /** |
||
393 | * Create a new the config manager |
||
394 | * |
||
395 | * @param array $aOptions The options array |
||
396 | * @param string $sKeys The keys of the options in the array |
||
397 | * |
||
398 | * @return Config The config manager |
||
399 | */ |
||
400 | public function newConfig(array $aOptions = [], $sKeys = '') |
||
404 | |||
405 | /** |
||
406 | * Get the dialog wrapper |
||
407 | * |
||
408 | * @return Dialog |
||
409 | */ |
||
410 | public function getDialog() |
||
414 | |||
415 | /** |
||
416 | * Get the minifier |
||
417 | * |
||
418 | * @return Minifier |
||
419 | */ |
||
420 | public function getMinifier() |
||
424 | |||
425 | /** |
||
426 | * Get the translator |
||
427 | * |
||
428 | * @return Translator |
||
429 | */ |
||
430 | public function getTranslator() |
||
434 | |||
435 | /** |
||
436 | * Get the template engine |
||
437 | * |
||
438 | * @return TemplateEngine |
||
439 | */ |
||
440 | public function getTemplateEngine() |
||
444 | |||
445 | /** |
||
446 | * Get the template renderer |
||
447 | * |
||
448 | * @return TemplateRenderer |
||
449 | */ |
||
450 | public function getTemplateRenderer() |
||
454 | |||
455 | /** |
||
456 | * Get the validator |
||
457 | * |
||
458 | * @return Validator |
||
459 | */ |
||
460 | public function getValidator() |
||
464 | |||
465 | /** |
||
466 | * Get the paginator |
||
467 | * |
||
468 | * @return Paginator |
||
469 | */ |
||
470 | public function getPaginator() |
||
474 | |||
475 | /** |
||
476 | * Get the event dispatcher |
||
477 | * |
||
478 | * @return EventDispatcher |
||
479 | */ |
||
480 | public function getEventDispatcher() |
||
484 | |||
485 | /** |
||
486 | * Get the global Response object |
||
487 | * |
||
488 | * @return Response |
||
489 | */ |
||
490 | public function getResponse() |
||
494 | |||
495 | /** |
||
496 | * Create a new Jaxon response object |
||
497 | * |
||
498 | * @return Response |
||
499 | */ |
||
500 | public function newResponse() |
||
504 | |||
505 | /** |
||
506 | * Get the App instance |
||
507 | * |
||
508 | * @return App |
||
509 | */ |
||
510 | public function getApp() |
||
514 | |||
515 | /** |
||
516 | * Get the App bootstrap |
||
517 | * |
||
518 | * @return Bootstrap |
||
519 | */ |
||
520 | public function getBootstrap() |
||
524 | |||
525 | /** |
||
526 | * Get the view manager |
||
527 | * |
||
528 | * @return ViewManager |
||
529 | */ |
||
530 | public function getViewManager() |
||
534 | |||
535 | /** |
||
536 | * Get the view facade |
||
537 | * |
||
538 | * @return ViewRenderer |
||
539 | */ |
||
540 | public function getViewRenderer() |
||
544 | |||
545 | /** |
||
546 | * Get the session manager |
||
547 | * |
||
548 | * @return SessionContract |
||
549 | */ |
||
550 | public function getSessionManager() |
||
554 | |||
555 | /** |
||
556 | * Set the session manager |
||
557 | * |
||
558 | * @param Closure $xClosure A closure to create the session manager instance |
||
559 | * |
||
560 | * @return void |
||
561 | */ |
||
562 | public function setSessionManager(Closure $xClosure) |
||
566 | |||
567 | /** |
||
568 | * Set the callable class request factory |
||
569 | * |
||
570 | * @param string $sClassName The callable class name |
||
571 | * @param CallableObject $xCallableObject The corresponding callable object |
||
572 | * |
||
573 | * @return void |
||
574 | */ |
||
575 | public function setCallableClassRequestFactory($sClassName, CallableObject $xCallableObject) |
||
581 | |||
582 | /** |
||
583 | * Get the callable class request factory |
||
584 | * |
||
585 | * @param string $sClassName The callable class name |
||
586 | * |
||
587 | * @return CallableClassRequestFactory |
||
588 | */ |
||
589 | public function getCallableClassRequestFactory($sClassName) |
||
593 | } |
||
594 |