/** * @param $method * @param bool $view */ protected function setCurrentMethod($method, $view = true) { $this->view->setCurrentMethod($method); if ($view && isset($this->currentView[$method]) && is_array($this->currentView[$method])) { $this->view->assign($this->currentView[$method]); } }
/** * @param null|string $method * @return PageView */ public function execute($method = null) { if (!$method) { $method = $this->request->getMethod(); } $this->view->setCurrentMethod($method); $execMethod = 'on' . ucwords($method); try { if (!method_exists($this->controller, $execMethod)) { throw new \RuntimeException('no method: ' . $method); } $this->controller->beginController($method); if ($contents = $this->execMethod($execMethod)) { $this->view->assign($contents); } $this->controller->finishController(); } catch (\Exception $e) { $this->view->critical($e->getMessage()); } return $this->view; }