示例#1
0
 public static function invoke($app_class, $app_root_dir, $env, Handler $handler = null)
 {
     $app = new $app_class($app_root_dir, $env);
     $dispatcher = new static($app);
     $dispatcher->boot();
     if ($app->isDebug()) {
         if (is_null($handler)) {
             $handler = new \Whoops\Handler\PrettyPageHandler();
         }
         $whoops = new \Whoops\Run();
         $whoops->pushHandler($handler);
         $whoops->register();
     }
     try {
         $response = $dispatcher->handleRequest();
     } catch (\Exception $e) {
         if ($app->isDebug()) {
             throw $e;
         }
         $response = $dispatcher->handleError($e);
     }
 }
示例#2
0
 public static function invoke($app_class, $app_root_dir, $env)
 {
     $app = new $app_class($app_root_dir, $env);
     $dispatcher = new static($app);
     $dispatcher->boot();
     try {
         $response = $dispatcher->handleRequest();
     } catch (\Exception $e) {
         // Please handle errors occurred on executing Dispatcher::handleError with your web server.
         // Dietcube doesn't care these errors.
         $response = $dispatcher->handleError($e);
     }
 }