hookManager **/ private $hookManager; /** * @var \Tools\ModuleManager $moduleManager * /core/tools/ModuleManager.php * load all active modules and contains informations about them * Can be accessed read-only via $instance->moduleManager **/ private $moduleManager; /** * @var \Tools\Router $router * /core/tools/Router.php * Contains information about directories and paths * Allow user to generate links * Can be accessed read-only via $instance->router **/ private $router; /** * TODO * @var \Tools\Cart $cart * /core/tools/Cart.php * Not defined yet * Can be accessed read-only via $instance->cart **/ private $cart; /** * TODO * @var \Tools\User $user (entity ?) * /core/tools/User.php * Can be accessed read-only via $instance->user **/ private $user; /** * Create context from $_SERVER environment * and initialize all data **/ public function __construct() { $this->hookManager = new Hooks($this); $this->router = new Router($this); if (!\Entity\ModelBase::init()) { @require_once(getcwd().'/core/setup/index.php'); die; } $this->router->init(); $this->moduleManager = new ModuleManager($this); $this->hookManager->trigger("routerSetup"); $this->router->serveUrl(); } /** * Getter function **/ public function __get($key) { switch ($key) { case "router": return $this->router; break; case "cart": return $this->cart; break; case "user": return $this->user; break; case "moduleManager": return $this->moduleManager; break; case "hookManager": return $this->hookManager; break; } throw new \Exception("Cannot access attribute {$key}"); } }