modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-03-08 08:28:49 +04:00
parent c154d44da1
commit b39ff95639
1 changed files with 3 additions and 1 deletions

View File

@ -6,7 +6,9 @@ namespace nur;
*/
class shutils {
static function ls_all(string $dir, ?string $pattern=null, int $sorting_order=SCANDIR_SORT_ASCENDING): array {
return array_filter(scandir($dir, $sorting_order),
$all = scandir($dir, $sorting_order);
if ($all === false) return [];
return array_filter($all,
function ($file) use ($pattern) {
if ($file === "." || $file === "..") return false;
return $pattern === null || fnmatch($pattern, $file);