/** * Initialize process * @param string $environment Array format only! * @throws ApplicationException * @return void */ public function init($environment = 'production') { $this->environment = $environment; try { // initial default helper path $this->addHelperPath(dirname(__FILE__) . '/Helper/'); // first log message Logger::info('app:init'); // setup configuration for current environment if ($debug = Config::getData('debug')) { $this->debugFlag = (bool) $debug; } // initial php settings if ($ini = Config::getData('php')) { foreach ($ini as $key => $value) { $result = ini_set($key, $value); Logger::info('app:init:php:' . $key . ':' . ($result ?: '---')); } } // init session, start inside class Session::getInstance(); // init Messages Messages::getInstance(); // init Translator Translator::getInstance(); // init request $this->initRequest(); // init response $this->initResponse(); // init router Router::getInstance(); } catch (\Exception $e) { throw new ApplicationException("Application can't be loaded: " . $e->getMessage()); } }
/** * Initialize process * * @param string $environment * @throws ApplicationException * @return void */ public function init($environment = 'production') { $this->environment = $environment; try { // first log message Logger::info('app:init'); // initial default helper path $this->addHelperPath(dirname(__FILE__) . '/Helper/'); // init Config $this->initConfig(); // init Session, start inside class (if needed) Session::getInstance(); // init Messages Messages::getInstance(); // init Translator Translator::getInstance(); // init Request $this->initRequest(); // init Response $this->initResponse(); // init Router $this->initRouter(); } catch (\Exception $e) { throw new ApplicationException("Application can't be loaded: " . $e->getMessage()); } }