/** * Method to run the application routines. * * @return void * * @since 1.0 */ public function doExecute() { try { $controller = $this->router->getController($this->get('uri.route')); $controller->execute(); } catch (\Exception $e) { $this->setErrorHeader($e); $data = ['error' => true, 'message' => $e->getMessage()]; $this->setBody(json_encode($data)); } }
/** * Method to run the application routines. * * @return void * * @since 1.0 */ public function doExecute() { try { $controller = $this->router->getController($this->get('uri.route')); $controller->execute(); } catch (\Exception $e) { // Log the error for reference $this->getLogger()->error($e->getMessage(), ['trace' => $e->getTraceAsString()]); $this->setErrorHeader($e); $data = ['error' => true, 'message' => $e->getMessage()]; $this->setBody(json_encode($data)); } }
/** * @param Router $router * * @return $this */ public function setRouter(Router $router) { $this->router = $router; $this->router->setApplication($this); return $this; }