return new \RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, $exclude), $mode);
}
- public static function listFilesOfDirectory($path, &$res = [])
+ public static function listFilesOfDirectory($path, &$res)
{
$files = scandir($path);
- foreach ($files as $key => $value) {
- $path = realpath($path . DIRECTORY_SEPARATOR . $value);
- if (!is_dir($path)) {
- $res[] = $path;
+ foreach ($files as $value) {
+ $p = realpath($path . DIRECTORY_SEPARATOR . $value);
+ if (!is_dir($p)) {
+ $res[] = $p;
} else if ($value != "." && $value != "..") {
- static::listFilesOfDirectory($path, $res);
- $res[] = $path;
+ static::listFilesOfDirectory($p, $res);
}
}
-
return $res;
-
}
/**