function __construct() { parent::__construct(); if (!defined('ROOT_DIR') || !ROOT_DIR) { $rootDir = realpath(__DIR__ . '../../../../../'); define('ROOT_DIR', $rootDir); } $this['sessions'] = function () { return $this->getSession(); }; $this['request'] = function () { return $this->getRequest(); }; $this['response'] = function () { return $this->getResponse(); }; $this['router'] = function () { return $this->getRouter(); }; $this['view'] = function () { return $this->getView(); }; $this["config"] = function () { return $this->getConfig(); }; $this["moduleManager"] = function () { $modulesList = $this->getConfig("modules", [])->toArray(); $mm = new ModuleManager($modulesList); $mm->setLoader($this->getLoader()); return $mm; }; }