/** * @param bool $cache */ public function __construct($cache) { $this->filesystem = new Filesystem(); $this->moduleContainer = new Container(); $this->cache = !$cache; $container = AppFactory::getInstance()->getContainer(); $container['cache'] = function () { $cacheContainer = new Container(); $cacheContainer->singleton('files', function () { return new Filesystem(); }); $cacheContainer->singleton('config', function () { return AppFactory::getInstance()->getContainer()->config['cache']; }); return new CacheManager($cacheContainer); }; $this->cacheManager = $container->get('cache'); }
public function beforeInitialization() { $this->app = AppFactory::getInstance(); $this->container = $this->app->getContainer(); }
protected static function checkDependency($arDependency = false) { if (!$arDependency || !is_array($arDependency)) { return; } foreach ($arDependency as $name) { if (self::$loadedModules[$name]) { continue; } if (self::$moduleContainer[$name]) { if (!self::$moduleContainer[$name]->config->installed) { continue; } if (!self::$moduleContainer[$name]->config->active) { AppFactory::getInstance('logger')->info("Module \"{$name}\" not active"); continue; } self::bootModuleContainer(self::$moduleContainer[$name]); } else { AppFactory::getInstance('logger')->error("Can't find module \"{$module}\" in container"); } } }