Exemplo n.º 1
0
 public function run()
 {
     plugin::run('before_run');
     auto::isDebugMode() && ($_debugMicrotime = microtime(true));
     if (self::$_pathDeep == self::path_deep3) {
         $className = 'controller_' . self::$_currentModule . '_' . self::$_currentController;
     } else {
         $className = 'controller_' . self::$_currentController;
     }
     if (!class_exists($className)) {
         throw new exception_404('controller not exist: ' . $className, exception_404::type_controller_not_exist);
     }
     $actionName = self::$_currentAction . 'Action';
     auto::isDebugMode() && auto::dqueue(__METHOD__ . '(' . $className . '->' . $actionName . ')', 'start ---->>>>');
     $class = new ReflectionClass($className);
     if ($class->isAbstract()) {
         throw new exception_404('can not run abstract class: ' . $className, exception_404::type_controller_is_abstract);
     }
     $method = $class->getMethod($actionName);
     if (!$method || !$method->isPublic()) {
         throw new exception_404('no public method ' . $method . ' exist in class:' . $className, exception_404::type_action_not_public);
     }
     $method->invoke($class->newInstance());
     auto::isDebugMode() && auto::dqueue(__METHOD__ . '(' . $className . '->' . $actionName . ')', 'end,<<<<---- cost ' . (microtime(true) - $_debugMicrotime) . 's');
     plugin::run('after_run');
 }