| Total Complexity | 40 | 
| Total Lines | 569 | 
| Duplicated Lines | 0 % | 
| Changes | 7 | ||
| Bugs | 0 | Features | 0 | 
Complex classes like Container often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Container, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 61 | class Container  | 
            ||
| 62 | { | 
            ||
| 63 | /**  | 
            ||
| 64 | * The Dependency Injection Container  | 
            ||
| 65 | *  | 
            ||
| 66 | * @var PimpleContainer  | 
            ||
| 67 | */  | 
            ||
| 68 | private $libContainer = null;  | 
            ||
| 69 | |||
| 70 | /**  | 
            ||
| 71 | * The Dependency Injection Container  | 
            ||
| 72 | *  | 
            ||
| 73 | * @var ContainerInterface  | 
            ||
| 74 | */  | 
            ||
| 75 | private $appContainer = null;  | 
            ||
| 76 | |||
| 77 | /**  | 
            ||
| 78 | * The class constructor  | 
            ||
| 79 | *  | 
            ||
| 80 | * @param array $aOptions The default options  | 
            ||
| 81 | */  | 
            ||
| 82 | public function __construct(array $aOptions)  | 
            ||
| 83 |     { | 
            ||
| 84 | $this->libContainer = new PimpleContainer();  | 
            ||
| 85 | $this->libContainer[Container::class] = $this;  | 
            ||
| 86 | |||
| 87 | $sTranslationDir = realpath(__DIR__ . '/../../../translations');  | 
            ||
| 88 | $sTemplateDir = realpath(__DIR__ . '/../../../templates');  | 
            ||
| 89 | $this->init($sTranslationDir, $sTemplateDir);  | 
            ||
| 90 | $this->getConfig()->setOptions($aOptions);  | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 | /**  | 
            ||
| 94 | * Get the container provided by the integrated framework  | 
            ||
| 95 | *  | 
            ||
| 96 | * @return ContainerInterface  | 
            ||
| 97 | */  | 
            ||
| 98 | public function getAppContainer()  | 
            ||
| 99 |     { | 
            ||
| 100 | return $this->appContainer;  | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 103 | /**  | 
            ||
| 104 | * Set the container provided by the integrated framework  | 
            ||
| 105 | *  | 
            ||
| 106 | * @param ContainerInterface $container The container implementation  | 
            ||
| 107 | *  | 
            ||
| 108 | * @return void  | 
            ||
| 109 | */  | 
            ||
| 110 | public function setAppContainer(ContainerInterface $container)  | 
            ||
| 111 |     { | 
            ||
| 112 | $this->appContainer = $container;  | 
            ||
| 113 | }  | 
            ||
| 114 | |||
| 115 | /**  | 
            ||
| 116 | * Set the parameters and create the objects in the dependency injection container  | 
            ||
| 117 | *  | 
            ||
| 118 | * @param string $sTranslationDir The translation directory  | 
            ||
| 119 | * @param string $sTemplateDir The template directory  | 
            ||
| 120 | *  | 
            ||
| 121 | * @return void  | 
            ||
| 122 | */  | 
            ||
| 123 | private function init($sTranslationDir, $sTemplateDir)  | 
            ||
| 124 |     { | 
            ||
| 125 | /*  | 
            ||
| 126 | * Parameters  | 
            ||
| 127 | */  | 
            ||
| 128 | // Translation directory  | 
            ||
| 129 | $this->libContainer['jaxon.core.translation_dir'] = $sTranslationDir;  | 
            ||
| 130 | // Template directory  | 
            ||
| 131 | $this->libContainer['jaxon.core.template_dir'] = $sTemplateDir;  | 
            ||
| 132 | |||
| 133 | /*  | 
            ||
| 134 | * Core library objects  | 
            ||
| 135 | */  | 
            ||
| 136 | // Global Response  | 
            ||
| 137 |         $this->libContainer[Response::class] = function() { | 
            ||
| 138 | return new Response();  | 
            ||
| 139 | };  | 
            ||
| 140 | // Dialog  | 
            ||
| 141 |         $this->libContainer[Dialog::class] = function() { | 
            ||
| 142 | return new Dialog();  | 
            ||
| 143 | };  | 
            ||
| 144 | // Jaxon App  | 
            ||
| 145 |         $this->libContainer[App::class] = function() { | 
            ||
| 146 | return new App();  | 
            ||
| 147 | };  | 
            ||
| 148 | // Jaxon App bootstrap  | 
            ||
| 149 |         $this->libContainer[Bootstrap::class] = function() { | 
            ||
| 150 | return new Bootstrap();  | 
            ||
| 151 | };  | 
            ||
| 152 | |||
| 153 | /*  | 
            ||
| 154 | * Plugins  | 
            ||
| 155 | */  | 
            ||
| 156 | // Callable objects repository  | 
            ||
| 157 |         $this->libContainer[CallableRepository::class] = function() { | 
            ||
| 158 | return new CallableRepository();  | 
            ||
| 159 | };  | 
            ||
| 160 | // Callable objects registry  | 
            ||
| 161 |         $this->libContainer[CallableRegistry::class] = function($c) { | 
            ||
| 162 | return new CallableRegistry($c[CallableRepository::class]);  | 
            ||
| 163 | };  | 
            ||
| 164 | // Callable class plugin  | 
            ||
| 165 |         $this->libContainer[CallableClass::class] = function($c) { | 
            ||
| 166 | return new CallableClass($c[CallableRegistry::class], $c[CallableRepository::class]);  | 
            ||
| 167 | };  | 
            ||
| 168 | // Callable dir plugin  | 
            ||
| 169 |         $this->libContainer[CallableDir::class] = function($c) { | 
            ||
| 170 | return new CallableDir($c[CallableRegistry::class]);  | 
            ||
| 171 | };  | 
            ||
| 172 | // Callable function plugin  | 
            ||
| 173 |         $this->libContainer[CallableFunction::class] = function() { | 
            ||
| 174 | return new CallableFunction();  | 
            ||
| 175 | };  | 
            ||
| 176 | // File upload support  | 
            ||
| 177 |         $this->libContainer[FileUploadSupport::class] = function() { | 
            ||
| 178 | return new FileUploadSupport();  | 
            ||
| 179 | };  | 
            ||
| 180 | // File upload plugin  | 
            ||
| 181 |         $this->libContainer[FileUpload::class] = function($c) { | 
            ||
| 182 | return new FileUpload($c[FileUploadSupport::class]);  | 
            ||
| 183 | };  | 
            ||
| 184 | // JQuery response plugin  | 
            ||
| 185 |         $this->libContainer[JQueryPlugin::class] = function() { | 
            ||
| 186 | return new JQueryPlugin();  | 
            ||
| 187 | };  | 
            ||
| 188 | |||
| 189 | /*  | 
            ||
| 190 | * Managers  | 
            ||
| 191 | */  | 
            ||
| 192 | // Plugin Manager  | 
            ||
| 193 |         $this->libContainer[PluginManager::class] = function($c) { | 
            ||
| 194 | return new PluginManager($c[CodeGenerator::class]);  | 
            ||
| 195 | };  | 
            ||
| 196 | // Request Handler  | 
            ||
| 197 |         $this->libContainer[RequestHandler::class] = function($c) { | 
            ||
| 198 | return new RequestHandler($c[PluginManager::class], $c[ResponseManager::class], $c[FileUpload::class]);  | 
            ||
| 199 | };  | 
            ||
| 200 | // Request Factory  | 
            ||
| 201 |         $this->libContainer[RequestFactory::class] = function($c) { | 
            ||
| 202 | return new RequestFactory($c[CallableRegistry::class]);  | 
            ||
| 203 | };  | 
            ||
| 204 | // Parameter Factory  | 
            ||
| 205 |         $this->libContainer[ParameterFactory::class] = function() { | 
            ||
| 206 | return new ParameterFactory();  | 
            ||
| 207 | };  | 
            ||
| 208 | // Response Manager  | 
            ||
| 209 |         $this->libContainer[ResponseManager::class] = function() { | 
            ||
| 210 | return new ResponseManager();  | 
            ||
| 211 | };  | 
            ||
| 212 | // Code Generator  | 
            ||
| 213 |         $this->libContainer[CodeGenerator::class] = function($c) { | 
            ||
| 214 | return new CodeGenerator($c[TemplateEngine::class]);  | 
            ||
| 215 | };  | 
            ||
| 216 | // View Manager  | 
            ||
| 217 |         $this->libContainer[ViewManager::class] = function() { | 
            ||
| 218 | $xViewManager = new ViewManager();  | 
            ||
| 219 | // Add the default view renderer  | 
            ||
| 220 |             $xViewManager->addRenderer('jaxon', function($di) { | 
            ||
| 221 | return new TemplateView($di->get(TemplateEngine::class));  | 
            ||
| 222 | });  | 
            ||
| 223 | // By default, render pagination templates with Jaxon.  | 
            ||
| 224 |             $xViewManager->addNamespace('pagination', '', '.php', 'jaxon'); | 
            ||
| 225 | return $xViewManager;  | 
            ||
| 226 | };  | 
            ||
| 227 | // View Renderer  | 
            ||
| 228 |         $this->libContainer[ViewRenderer::class] = function($c) { | 
            ||
| 229 | return new ViewRenderer($c[ViewManager::class]);  | 
            ||
| 230 | };  | 
            ||
| 231 | // Set the default session manager  | 
            ||
| 232 |         $this->libContainer[SessionContract::class] = function() { | 
            ||
| 233 | return new SessionManager();  | 
            ||
| 234 | };  | 
            ||
| 235 | |||
| 236 | /*  | 
            ||
| 237 | * Config  | 
            ||
| 238 | */  | 
            ||
| 239 |         $this->libContainer[Config::class] = function() { | 
            ||
| 240 | return new Config();  | 
            ||
| 241 | };  | 
            ||
| 242 |         $this->libContainer[ConfigReader::class] = function() { | 
            ||
| 243 | return new ConfigReader();  | 
            ||
| 244 | };  | 
            ||
| 245 | |||
| 246 | /*  | 
            ||
| 247 | * Services  | 
            ||
| 248 | */  | 
            ||
| 249 | // Minifier  | 
            ||
| 250 |         $this->libContainer[Minifier::class] = function() { | 
            ||
| 251 | return new Minifier();  | 
            ||
| 252 | };  | 
            ||
| 253 | // Translator  | 
            ||
| 254 |         $this->libContainer[Translator::class] = function($c) { | 
            ||
| 255 | return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]);  | 
            ||
| 256 | };  | 
            ||
| 257 | // Template engine  | 
            ||
| 258 |         $this->libContainer[TemplateEngine::class] = function($c) { | 
            ||
| 259 | return new TemplateEngine($c['jaxon.core.template_dir']);  | 
            ||
| 260 | };  | 
            ||
| 261 | // Validator  | 
            ||
| 262 |         $this->libContainer[Validator::class] = function($c) { | 
            ||
| 263 | return new Validator($c[Translator::class], $c[Config::class]);  | 
            ||
| 264 | };  | 
            ||
| 265 | // Pagination Paginator  | 
            ||
| 266 |         $this->libContainer[Paginator::class] = function($c) { | 
            ||
| 267 | return new Paginator($c[PaginationRenderer::class]);  | 
            ||
| 268 | };  | 
            ||
| 269 | // Pagination Renderer  | 
            ||
| 270 |         $this->libContainer[PaginationRenderer::class] = function($c) { | 
            ||
| 271 | return new PaginationRenderer($c[ViewRenderer::class]);  | 
            ||
| 272 | };  | 
            ||
| 273 | // Event Dispatcher  | 
            ||
| 274 |         $this->libContainer[EventDispatcher::class] = function() { | 
            ||
| 275 | return new EventDispatcher();  | 
            ||
| 276 | };  | 
            ||
| 277 | // URI decoder  | 
            ||
| 278 |         $this->libContainer[URI::class] = function() { | 
            ||
| 279 | return new URI();  | 
            ||
| 280 | };  | 
            ||
| 281 | }  | 
            ||
| 282 | |||
| 283 | /**  | 
            ||
| 284 | * Get a class instance  | 
            ||
| 285 | *  | 
            ||
| 286 | * @return object The class instance  | 
            ||
| 287 | */  | 
            ||
| 288 | public function get($sClass)  | 
            ||
| 289 |     { | 
            ||
| 290 | if($this->appContainer != null && $this->appContainer->has($sClass))  | 
            ||
| 291 |         { | 
            ||
| 292 | return $this->appContainer->get($sClass);  | 
            ||
| 293 | }  | 
            ||
| 294 | return $this->libContainer[$sClass];  | 
            ||
| 295 | }  | 
            ||
| 296 | |||
| 297 | /**  | 
            ||
| 298 | * Set a DI closure  | 
            ||
| 299 | *  | 
            ||
| 300 | * @param string $sClass The full class name  | 
            ||
| 301 | * @param Closure $xClosure The closure  | 
            ||
| 302 | *  | 
            ||
| 303 | * @return void  | 
            ||
| 304 | */  | 
            ||
| 305 | public function set($sClass, Closure $xClosure)  | 
            ||
| 306 |     { | 
            ||
| 307 |         $this->libContainer[$sClass] = function() use($xClosure) { | 
            ||
| 308 | return call_user_func($xClosure, $this);  | 
            ||
| 309 | };  | 
            ||
| 310 | }  | 
            ||
| 311 | |||
| 312 | /**  | 
            ||
| 313 | * Set an alias  | 
            ||
| 314 | *  | 
            ||
| 315 | * @param string $sClass The class name  | 
            ||
| 316 | * @param string $sAlias The alias name  | 
            ||
| 317 | *  | 
            ||
| 318 | * @return void  | 
            ||
| 319 | */  | 
            ||
| 320 | public function alias($sClass, $sAlias)  | 
            ||
| 321 |     { | 
            ||
| 322 |         $this->libContainer[$sClass] = function($c) use ($sAlias) { | 
            ||
| 323 | return $c[$sAlias];  | 
            ||
| 324 | };  | 
            ||
| 325 | }  | 
            ||
| 326 | |||
| 327 | /**  | 
            ||
| 328 | * Create an instance of a class, getting the contructor parameters from the DI container  | 
            ||
| 329 | *  | 
            ||
| 330 | * @param string|ReflectionClass $xClass The class name or the reflection class  | 
            ||
| 331 | *  | 
            ||
| 332 | * @return null|object  | 
            ||
| 333 | */  | 
            ||
| 334 | public function make($xClass)  | 
            ||
| 335 |     { | 
            ||
| 336 | if(is_string($xClass))  | 
            ||
| 337 |         { | 
            ||
| 338 | // Create the reflection class instance  | 
            ||
| 339 | $xClass = new ReflectionClass($xClass);  | 
            ||
| 340 | }  | 
            ||
| 341 | if(!($xClass instanceof ReflectionClass))  | 
            ||
| 342 |         { | 
            ||
| 343 | return null;  | 
            ||
| 344 | }  | 
            ||
| 345 | // Use the Reflection class to get the parameters of the constructor  | 
            ||
| 346 | if(($constructor = $xClass->getConstructor()) == null)  | 
            ||
| 347 |         { | 
            ||
| 348 | return $xClass->newInstance();  | 
            ||
| 349 | }  | 
            ||
| 350 | $parameters = $constructor->getParameters();  | 
            ||
| 351 | $parameterInstances = [];  | 
            ||
| 352 | foreach($parameters as $parameter)  | 
            ||
| 353 |         { | 
            ||
| 354 | // Get the parameter instance from the DI  | 
            ||
| 355 | $parameterInstances[] = $this->get($parameter->getClass()->getName());  | 
            ||
| 356 | }  | 
            ||
| 357 | return $xClass->newInstanceArgs($parameterInstances);  | 
            ||
| 358 | }  | 
            ||
| 359 | |||
| 360 | /**  | 
            ||
| 361 | * Get the plugin manager  | 
            ||
| 362 | *  | 
            ||
| 363 | * @return PluginManager  | 
            ||
| 364 | */  | 
            ||
| 365 | public function getPluginManager()  | 
            ||
| 366 |     { | 
            ||
| 367 | return $this->libContainer[PluginManager::class];  | 
            ||
| 368 | }  | 
            ||
| 369 | |||
| 370 | /**  | 
            ||
| 371 | * Get the request handler  | 
            ||
| 372 | *  | 
            ||
| 373 | * @return RequestHandler  | 
            ||
| 374 | */  | 
            ||
| 375 | public function getRequestHandler()  | 
            ||
| 376 |     { | 
            ||
| 377 | return $this->libContainer[RequestHandler::class];  | 
            ||
| 378 | }  | 
            ||
| 379 | |||
| 380 | /**  | 
            ||
| 381 | * Get the request factory  | 
            ||
| 382 | *  | 
            ||
| 383 | * @return RequestFactory  | 
            ||
| 384 | */  | 
            ||
| 385 | public function getRequestFactory()  | 
            ||
| 386 |     { | 
            ||
| 387 | return $this->libContainer[RequestFactory::class];  | 
            ||
| 388 | }  | 
            ||
| 389 | |||
| 390 | /**  | 
            ||
| 391 | * Get the parameter factory  | 
            ||
| 392 | *  | 
            ||
| 393 | * @return ParameterFactory  | 
            ||
| 394 | */  | 
            ||
| 395 | public function getParameterFactory()  | 
            ||
| 396 |     { | 
            ||
| 397 | return $this->libContainer[ParameterFactory::class];  | 
            ||
| 398 | }  | 
            ||
| 399 | |||
| 400 | /**  | 
            ||
| 401 | * Get the response manager  | 
            ||
| 402 | *  | 
            ||
| 403 | * @return ResponseManager  | 
            ||
| 404 | */  | 
            ||
| 405 | public function getResponseManager()  | 
            ||
| 408 | }  | 
            ||
| 409 | |||
| 410 | /**  | 
            ||
| 411 | * Get the code generator  | 
            ||
| 412 | *  | 
            ||
| 413 | * @return CodeGenerator  | 
            ||
| 414 | */  | 
            ||
| 415 | public function getCodeGenerator()  | 
            ||
| 416 |     { | 
            ||
| 417 | return $this->libContainer[CodeGenerator::class];  | 
            ||
| 418 | }  | 
            ||
| 419 | |||
| 420 | /**  | 
            ||
| 421 | * Get the callable registry  | 
            ||
| 422 | *  | 
            ||
| 423 | * @return CallableRegistry  | 
            ||
| 424 | */  | 
            ||
| 425 | public function getCallableRegistry()  | 
            ||
| 426 |     { | 
            ||
| 427 | return $this->libContainer[CallableRegistry::class];  | 
            ||
| 428 | }  | 
            ||
| 429 | |||
| 430 | /**  | 
            ||
| 431 | * Get the config manager  | 
            ||
| 432 | *  | 
            ||
| 433 | * @return Config  | 
            ||
| 434 | */  | 
            ||
| 435 | public function getConfig()  | 
            ||
| 436 |     { | 
            ||
| 437 | return $this->libContainer[Config::class];  | 
            ||
| 438 | }  | 
            ||
| 439 | |||
| 440 | /**  | 
            ||
| 441 | * Create a new the config manager  | 
            ||
| 442 | *  | 
            ||
| 443 | * @param array $aOptions The options array  | 
            ||
| 444 | * @param string $sKeys The keys of the options in the array  | 
            ||
| 445 | *  | 
            ||
| 446 | * @return Config The config manager  | 
            ||
| 447 | */  | 
            ||
| 448 | public function newConfig(array $aOptions = [], $sKeys = '')  | 
            ||
| 449 |     { | 
            ||
| 450 | return new Config($aOptions, $sKeys);  | 
            ||
| 451 | }  | 
            ||
| 452 | |||
| 453 | /**  | 
            ||
| 454 | * Get the dialog wrapper  | 
            ||
| 455 | *  | 
            ||
| 456 | * @return Dialog  | 
            ||
| 457 | */  | 
            ||
| 458 | public function getDialog()  | 
            ||
| 459 |     { | 
            ||
| 460 | return $this->libContainer[Dialog::class];  | 
            ||
| 461 | }  | 
            ||
| 462 | |||
| 463 | /**  | 
            ||
| 464 | * Get the minifier  | 
            ||
| 465 | *  | 
            ||
| 466 | * @return Minifier  | 
            ||
| 467 | */  | 
            ||
| 468 | public function getMinifier()  | 
            ||
| 471 | }  | 
            ||
| 472 | |||
| 473 | /**  | 
            ||
| 474 | * Get the translator  | 
            ||
| 475 | *  | 
            ||
| 476 | * @return Translator  | 
            ||
| 477 | */  | 
            ||
| 478 | public function getTranslator()  | 
            ||
| 479 |     { | 
            ||
| 480 | return $this->libContainer[Translator::class];  | 
            ||
| 481 | }  | 
            ||
| 482 | |||
| 483 | /**  | 
            ||
| 484 | * Get the template engine  | 
            ||
| 485 | *  | 
            ||
| 486 | * @return TemplateEngine  | 
            ||
| 487 | */  | 
            ||
| 488 | public function getTemplateEngine()  | 
            ||
| 489 |     { | 
            ||
| 490 | return $this->libContainer[TemplateEngine::class];  | 
            ||
| 491 | }  | 
            ||
| 492 | |||
| 493 | /**  | 
            ||
| 494 | * Get the validator  | 
            ||
| 495 | *  | 
            ||
| 496 | * @return Validator  | 
            ||
| 497 | */  | 
            ||
| 498 | public function getValidator()  | 
            ||
| 499 |     { | 
            ||
| 500 | return $this->libContainer[Validator::class];  | 
            ||
| 501 | }  | 
            ||
| 502 | |||
| 503 | /**  | 
            ||
| 504 | * Get the paginator  | 
            ||
| 505 | *  | 
            ||
| 506 | * @return Paginator  | 
            ||
| 507 | */  | 
            ||
| 508 | public function getPaginator()  | 
            ||
| 511 | }  | 
            ||
| 512 | |||
| 513 | /**  | 
            ||
| 514 | * Get the event dispatcher  | 
            ||
| 515 | *  | 
            ||
| 516 | * @return EventDispatcher  | 
            ||
| 517 | */  | 
            ||
| 518 | public function getEventDispatcher()  | 
            ||
| 519 |     { | 
            ||
| 520 | return $this->libContainer[EventDispatcher::class];  | 
            ||
| 521 | }  | 
            ||
| 522 | |||
| 523 | /**  | 
            ||
| 524 | * Get the global Response object  | 
            ||
| 525 | *  | 
            ||
| 526 | * @return Response  | 
            ||
| 527 | */  | 
            ||
| 528 | public function getResponse()  | 
            ||
| 531 | }  | 
            ||
| 532 | |||
| 533 | /**  | 
            ||
| 534 | * Create a new Jaxon response object  | 
            ||
| 535 | *  | 
            ||
| 536 | * @return Response  | 
            ||
| 537 | */  | 
            ||
| 538 | public function newResponse()  | 
            ||
| 539 |     { | 
            ||
| 540 | return new Response();  | 
            ||
| 541 | }  | 
            ||
| 542 | |||
| 543 | /**  | 
            ||
| 544 | * Get the App instance  | 
            ||
| 545 | *  | 
            ||
| 546 | * @return App  | 
            ||
| 547 | */  | 
            ||
| 548 | public function getApp()  | 
            ||
| 549 |     { | 
            ||
| 550 | return $this->libContainer[App::class];  | 
            ||
| 551 | }  | 
            ||
| 552 | |||
| 553 | /**  | 
            ||
| 554 | * Get the App bootstrap  | 
            ||
| 555 | *  | 
            ||
| 556 | * @return Bootstrap  | 
            ||
| 557 | */  | 
            ||
| 558 | public function getBootstrap()  | 
            ||
| 559 |     { | 
            ||
| 560 | return $this->libContainer[Bootstrap::class];  | 
            ||
| 561 | }  | 
            ||
| 562 | |||
| 563 | /**  | 
            ||
| 564 | * Get the view manager  | 
            ||
| 565 | *  | 
            ||
| 566 | * @return ViewManager  | 
            ||
| 567 | */  | 
            ||
| 568 | public function getViewManager()  | 
            ||
| 569 |     { | 
            ||
| 570 | return $this->libContainer[ViewManager::class];  | 
            ||
| 571 | }  | 
            ||
| 572 | |||
| 573 | /**  | 
            ||
| 574 | * Get the view facade  | 
            ||
| 575 | *  | 
            ||
| 576 | * @return ViewRenderer  | 
            ||
| 577 | */  | 
            ||
| 578 | public function getViewRenderer()  | 
            ||
| 579 |     { | 
            ||
| 580 | return $this->libContainer[ViewRenderer::class];  | 
            ||
| 581 | }  | 
            ||
| 582 | |||
| 583 | /**  | 
            ||
| 584 | * Get the session manager  | 
            ||
| 585 | *  | 
            ||
| 586 | * @return SessionContract  | 
            ||
| 587 | */  | 
            ||
| 588 | public function getSessionManager()  | 
            ||
| 589 |     { | 
            ||
| 590 | return $this->libContainer[SessionContract::class];  | 
            ||
| 591 | }  | 
            ||
| 592 | |||
| 593 | /**  | 
            ||
| 594 | * Set the session manager  | 
            ||
| 595 | *  | 
            ||
| 596 | * @param Closure $xClosure A closure to create the session manager instance  | 
            ||
| 597 | *  | 
            ||
| 598 | * @return void  | 
            ||
| 599 | */  | 
            ||
| 600 | public function setSessionManager(Closure $xClosure)  | 
            ||
| 601 |     { | 
            ||
| 602 | $this->libContainer[SessionContract::class] = $xClosure;  | 
            ||
| 603 | }  | 
            ||
| 604 | |||
| 605 | /**  | 
            ||
| 606 | * Set the callable class request factory  | 
            ||
| 607 | *  | 
            ||
| 608 | * @param string $sClassName The callable class name  | 
            ||
| 609 | * @param CallableObject $xCallableObject The corresponding callable object  | 
            ||
| 610 | *  | 
            ||
| 611 | * @return void  | 
            ||
| 612 | */  | 
            ||
| 613 | public function setCallableClassRequestFactory($sClassName, CallableObject $xCallableObject)  | 
            ||
| 617 | };  | 
            ||
| 618 | }  | 
            ||
| 619 | |||
| 620 | /**  | 
            ||
| 621 | * Get the callable class request factory  | 
            ||
| 622 | *  | 
            ||
| 623 | * @param string $sClassName The callable class name  | 
            ||
| 624 | *  | 
            ||
| 625 | * @return CallableClassRequestFactory  | 
            ||
| 626 | */  | 
            ||
| 627 | public function getCallableClassRequestFactory($sClassName)  | 
            ||
| 628 |     { | 
            ||
| 629 | return $this->libContainer[$sClassName . '_RequestFactory'];  | 
            ||
| 630 | }  | 
            ||
| 631 | }  | 
            ||
| 632 |