/** * */ public function boot() { try { if ($this->devmode) { $this->stopwatch = $this->injector->injectClass("develop.stopwatch"); $this->stopwatch->start(); } /** * @var Application $application */ $this->application = $this->injector->injectClass("framework.application"); $this->application->init($this->applicationConfig); } catch (DeclarationNotFound $e) { $this->application = $this->handleError($e); } catch (ClassNotFound $e) { $this->application = $this->handleError($e); } catch (WrongArguments $e) { $this->application = $this->handleError($e); } catch (\Exception $e) { $this->application = $this->handleError($e); } }
/** * */ public function determineController() { try { $controller = $this->router->getController(); } catch (RouteNotFound $e) { $controller = "framework.errorController"; $this->controllerError = IControllerError::PAGE_NOT_FOUND; } catch (WrongMethod $e) { $controller = "framework.errorController"; $this->controllerError = IControllerError::METHOD_NOT_ALLOWED; $this->kernel->getResponse()->addValue("error", $e->getMessage()); } $this->controller = $this->injector->injectClass($controller); }
/** * */ public function run() { try { /** * @var Application $application */ $application = $this->injector->injectClass("framework.application"); } catch (DeclarationNotFound $e) { $application = $this->handleError($e); } catch (ClassNotFound $e) { $application = $this->handleError($e); } catch (WrongArguments $e) { $application = $this->handleError($e); } catch (\Exception $e) { $application = $this->handleError($e); } $application->init($this->applicationConfig); $application->determineController(); $application->determineAction(); $application->executeAction(); $this->response = $application->returnResponse(); }