コード例 #1
0
ファイル: router.php プロジェクト: dimichspb/basic-users-app
 public static function setAction($action = self::NOTFOUND_ACTION)
 {
     if (empty($action)) {
         $action = self::NOTFOUND_ACTION;
     }
     $action = Application::getConfigItem('actionPrefix') . ucfirst($action);
     $controller = self::getController();
     if (empty($controller)) {
         throw new \Exception('controller should be set before action');
     }
     $reflector = new \ReflectionClass($controller);
     if (!$reflector->hasMethod($action)) {
         throw new \Exception('controller action ' . $action . ' has been not defined');
     }
     self::$action = $action;
     return;
 }