/** * __construct * * Gets the Request from the Bootstrap * * @param Dic $_container */ public function __construct(Dic $_container) { $this->_container = $_container; $this->_request = $_container->getResource('Request'); $this->_router = $_container->getResource('Router'); $this->_router->setPackages($this->_container->getResource('Packages')); }
/** * bootstrap * * The Bootstrap object is created with 5 initial resources (Packages, AppStage, Autoloader, Request, Error) * and then the container is initialized with the minimum resources for a cached response (Session, Role, Cache, Router) */ private function _initDependencyInjectionContainer() { $this->_container = new Dic(); $this->_container->addResource('Packages', $this->_packages); $this->_container->addResource('AppStage', $this->_appStage); $this->_container->addResource('AutoLoader', $this->_autoLoader); $this->_container->addResource('Request', $this->_request); $this->_container->addResource('Error', $this->_error); $this->_container->_initTheContainer(); }