Exemple #1
0
 /**
  * @brief 迭代出actions目录的所有action文件 
  * 这样在做路由的时候 检测路由是hash操作 不会有文件检测的io操作 更高效更快速
  * @param \Aha\Mvc\Aha\Bootstrap $bootstrap
  */
 public static function loadActionPaths(\Aha\Bootstrap $bootstrap)
 {
     $appNamespace = $bootstrap->getAppNamespace();
     $appPath = $bootstrap->getLoader()->getPathByByNamespace($appNamespace);
     $actionPath = $appPath . DIRECTORY_SEPARATOR . $appNamespace . DIRECTORY_SEPARATOR . 'Actions';
     self::$_arrActions = array();
     $directoryIt = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($actionPath));
     $directoryIt->rewind();
     while ($directoryIt->valid()) {
         if (!$directoryIt->isDot() && substr($directoryIt->key(), -4) === AHA_EXT) {
             array_push(self::$_arrActions, substr($directoryIt->key(), 0, -strlen(AHA_EXT)));
         }
         $directoryIt->next();
     }
 }