/** * @param IContainer $container */ public function __construct(IContainer $container) { $this->container = $container; $path = dirname(str_replace(['\\', 'App'], ['/', $container->kernel->getAppDir()], get_called_class())) . '/config.php'; if (file_exists($path)) { $container->load($path); } }
/** * Initialize container * * @access public * * @param string $configPath Path to configure Container * * @return void */ public function initContainer($configPath) { $this->container = new Container(); $this->container->kernel = $this; $this->container->load($configPath); if (false === $this->container->dispatcher) { $this->container->dispatcher = new Dispatcher($this->container); } }