Пример #1
0
 /**
  * @return Router
  */
 public function getRouter()
 {
     if (empty(static::$router)) {
         $routes = $this->dataFactory->getRoutes();
         static::$router = new Router($routes);
     }
     return static::$router;
 }
Пример #2
0
 /**
  * Run the application. If there is an exception thrown send an 500.
  *
  * @param Request $request
  */
 public function run(Request $request)
 {
     try {
         $this->handleRequest($request);
     } catch (Exception $e) {
         $logger = $this->masterFactory->getDebugFactory()->getErrorLogger();
         $logger->error($e->getMessage() . PHP_EOL . $e->getTraceAsString());
         header(sprintf('Status: %s', Response::getMessageForCode(500)));
         if (Settings::isDevMode()) {
             echo $e->getMessage() . PHP_EOL;
             echo '<pre>';
             echo $e->getTraceAsString();
             echo '</pre>';
         }
     }
 }