/** * Обработка пользовательского запроса. */ private function handleRequest() { $request = \REXFramework\registry\RequestRegistry::instance(); $cmdResolver = new CommandResolver(); $cmd = $cmdResolver->getCmd($request); $cmd->execute(); }
/** * Инициализация объекта контроллера действий, заполнение свойств. */ public function __construct() { $this->view = new View(); $this->config = ApplicationRegistry::instance(); $this->request = RequestRegistry::instance(); $this->session = SessionRegistry::instance(); }
/** * Обработка исключений. * Может быть переопределен в дочерних классах. */ public function process() { header('HTTP/1.0 404 Not Found'); $request = \REXFramework\registry\RequestRegistry::instance(); $request->setProperty('app_error', $this); $request->setProperty('controller', 'error'); $request->setProperty('action', 'index'); $module = $request->getProperty('module'); $controllerName = '\\App\\modules\\' . strtolower($module) . '\\controllers\\' . 'ErrorController'; try { $controller = new $controllerName(); $controller->execute(); } catch (\Exception $e) { echo "Возникло исключение при обработке исключения.\n" . "Во избежание зацикливания выполнение прервано.\n" . "Сообщение: " . $e->getMessage(); } }