/** * Run the application. * * @param boolean $exit * @return void */ public function run($exit = true) { // If route is allowed for this method $this->router->addRoutes($this->routes[strtolower($_SERVER['REQUEST_METHOD'])]); $this->router->route(); if ($this->router->hasRoute() && $this->isAllowed($this->router->getRouteMatch()->getOriginalRoute())) { parent::run($exit); } else { $this->trigger('app.error', ['exception' => new Exception('Error: That route was not ' . ($this->router->hasRoute() ? 'allowed' : 'found') . '.')]); $this->router->getRouteMatch()->noRouteFound((bool) $exit); } }