Beispiel #1
0
 public function walk_src($src)
 {
     $findFile = new FindFile();
     $allFiles = $findFile->Find($src);
     #var_dump($allFiles);
     $packages = array();
     $functions = array();
     preg_match_all("/.*\\.svn.*/", join("\n", $allFiles), $matches);
     $allFiles = join("\n", array_diff($allFiles, $matches[0]));
     preg_match_all("/.*(baidu\\/.*)/", $allFiles, $allMatch);
     foreach ($allMatch[1] as $singleFile) {
         preg_match("/.*(baidu.*)\\/\$/", $singleFile, $pkgMatch);
         if (isset($pkgMatch[1])) {
             $package = str_replace("/", ".", $pkgMatch[1]);
             $funcs = $findFile->Find(realpath($src . "/" . $singleFile), array("noLoop" => true, "except" => "/.*\\.svn.*/", "noDir" => true, "removePrefix" => $src . "/"));
             $funcs = str_replace("/", ".", str_replace(".js", "", $funcs));
             array_push($packages, array("packageName" => $package, "functions" => $funcs));
         }
     }
     foreach ($allMatch[1] as $singleFile) {
         preg_match("/.*(baidu.*).js\$/", $singleFile, $funcMatch);
         if (isset($funcMatch[1])) {
             $functionName = str_replace("/", ".", $funcMatch[1]);
             $functions[$functionName] = $this->get_func($functionName, $src);
         }
     }
     return array("packages" => $packages, "functions" => $functions);
 }
 /** Construct from path and regular expression
  *
  * @param $path the directory to search in
  *              If path contains ';' then this parameter is split and every
  *              part of it is used as separate directory.
  * @param $regex perl style regular expression to find files with
  */
 function __construct($path, $regex)
 {
     parent::__construct($path, $regex);
 }