/** * Run proxy detection. * * @throws Phoenix\Exceptions\FailureException * @return void */ private function runProxy() { try { if ($this->isFrontControllerRequest() === true) { $this->performFrontControllerRequest(); return; } if ($this->isProxyRequest() === true) { $this->performProxyRequest(); } } catch (NoticeException $e) { $this->response = ResponseFactory::createResponse($this->response_format); $this->response->setException($e); } catch (WarningException $e) { Logger::log($e, $this->db); $this->response = ResponseFactory::createResponse($this->response_format); $this->response->setException($e); } catch (FailureException $e) { Logger::log($e); $this->response = ResponseFactory::createResponse($this->response_format); $this->response->setException($e); } catch (Exception $e) { Logger::log($e); $this->response = ResponseFactory::createResponse($this->response_format); $this->response->setException($e); } }
/** * Perform action on this view. * * @throws Phoenix\Exceptions\WarningException * @return void */ private function performViewAction() { /* * ($this->response == null) means that cotroller does not throw any exception and everything is ok * * ($this->response == Response && $this->response->getException() == NoticeException) means that controller * throws NoticeException * * it is possible to create new response with content only in situations mentioned above */ $action_name = $this->request->getUrl()->getQueryParameter(self::URL_GET_ACTION); if (is_null($this->response) || $this->response instanceof Response && $this->response->getException() instanceof NoticeException) { if (System::isCallable($this->view, $action_name)) { $old_exception = $this->response instanceof Response && $this->response->getException() instanceof NoticeException ? $this->response->getException() : null; $this->view->{$action_name}(); $this->response = $this->view->getResponse(); $this->response->setException($old_exception); } else { throw new WarningException(FrameworkExceptions::W_ROUTER_INVALID_ACTION, json_encode($this->request)); } } }