Example #1
0
 public function start()
 {
     $this->initController();
     View::$controllerName = $this->controllerName;
     View::$actionName = $this->actionName;
     View::$isArea = $this->isArea;
     if ($this->isArea) {
         View::$areaName = $this->areaName;
     }
     try {
         $method = new \ReflectionMethod($this->controller, $this->actionName);
         foreach ($method->getParameters() as $param) {
             $param = $param->getType()->__toString();
             if (class_exists($param)) {
                 $this->requestParams[] = new $param();
             }
         }
         call_user_func_array(array($this->controller, $this->actionName), $this->requestParams);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage(), 404);
     }
 }