private static function doGlobForPath($path, $options) {
    $dirname = static::getDirNameForPath($path);
    $basename = static::getBaseNameForPath($path);

    $expanded_path = static::splitPathOnWildcard($dirname);
    if ($expanded_path === false) {
      return static::doGlobForExpandedPath($path, $options);
    }

    // Use glob to get the directory expansion for the wildcard path.
    $path = $expanded_path[0] . $expanded_path[1];
    $dirs = static::doGlobForPath($path, GLOB_ONLYDIR);
    $results = [];
    foreach ($dirs as $dir) {
      // Stitch the full path back together and then recurse.
      $dirname = $expanded_path[0] . $dir . $expanded_path[2];
      $path = $dirname . DIRECTORY_SEPARATOR . $basename;
      $subdir = static::doGlobForPath($path, $options);
      $results = array_merge($results, $subdir);
    }
    return $results;
  }
private static function doGlobForPath($path, $options) {
    $dirname = static::getDirNameForPath($path);
    $basename = static::getBaseNameForPath($path);

    $expanded_path = static::splitPathOnWildcard($dirname);
    if ($expanded_path === false) {
      return static::doGlobForExpandedPath($path, $options);
    }

    // Use glob to get the directory expansion for the wildcard path.
    $path = $expanded_path[0] . $expanded_path[1];
    $dirs = static::doGlobForPath($path, GLOB_ONLYDIR);
    $results = [];
    foreach ($dirs as $dir) {
      // Stitch the full path back together and then recurse.
      $dirname = $expanded_path[0] . $dir . $expanded_path[2];
      $path = $dirname . DIRECTORY_SEPARATOR . $basename;
      $subdir = static::doGlobForPath($path, $options);
      $results = array_merge($results, $subdir);
    }
    return $results;
  }
private static function doGlobForPath ( $ path , $ options ) { $ dirname = static :: getDirNameForPath ( $ path ) ; $ basename = static :: getBaseNameForPath ( $ path ) ; $ expanded_path = static :: splitPathOnWildcard ( $ dirname ) ; if ( $ expanded_path === false ) { return static :: doGlobForExpandedPath ( $ path , $ options ) ; } // Use glob to get the directory expansion for the wildcard path. $ path = $ expanded_path [ 0 ] . $ expanded_path [ 1 ] ; $ dirs = static :: doGlobForPath ( $ path , GLOB_ONLYDIR ) ; $ results = [ ] ; foreach ( $ dirs as $ dir ) { // Stitch the full path back together and then recurse. $ dirname = $ expanded_path [ 0 ] . $ dir . $ expanded_path [ 2 ] ; $ path = $ dirname . DIRECTORY_SEPARATOR . $ basename ; $ subdir = static :: doGlobForPath ( $ path , $ options ) ; $ results = array_merge ( $ results , $ subdir ) ; } return $ results ; }
Glob a given path, after braces have been expanded but before wildcards
have been expanded.

@param string $path The path to glob, can contain wildcards.
@param int $options Valid Glob flags.
@return Returns an array containing the matched files/directories, an
empty array if no file matched or FALSE on error.
Glob a given path after braces have been expanded but before wildcards have been expanded .