예제 #1
0
 /**
  * @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]);
     }
 }
예제 #2
0
파일: Dispatch.php 프로젝트: wscore/pages
 /**
  * @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;
 }