Пример #1
0
 /**
  * Bootstrap
  *
  * @param array $config
  * @throws \rock\base\BaseException
  */
 public static function bootstrap(array $config)
 {
     Trace::beginProfile(Trace::APP, Trace::TOKEN_APP_RUNTIME);
     static::$components = $config['components'];
     unset($config['components']);
     static::$config = $config;
     Container::registerMulti(static::$components);
     $response = static::$app->response;
     try {
         // Triggered at the beginning
         Event::trigger(static::className(), self::EVENT_BEGIN_APP);
         // Routing
         $route = static::$app->route;
         $route->response = $response;
         $route->run();
     } catch (\Exception $e) {
         ErrorHandler::display($e, Log::CRITICAL, $response);
     }
     //var_dump(Trace::getTime(Trace::APP_TIME));
     Trace::endProfile(Trace::APP, Trace::TOKEN_APP_RUNTIME);
     //var_dump(Trace::get('db.query'), Trace::get(\rock\helpers\Trace::APP));
     // Triggered at the end
     Event::trigger(static::className(), self::EVENT_END_APP);
     $response->send();
 }