Exemple #1
0
 /**
  * @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;
 }