modifs.mineures sans commentaires
This commit is contained in:
parent
c154d44da1
commit
b39ff95639
|
@ -6,7 +6,9 @@ namespace nur;
|
||||||
*/
|
*/
|
||||||
class shutils {
|
class shutils {
|
||||||
static function ls_all(string $dir, ?string $pattern=null, int $sorting_order=SCANDIR_SORT_ASCENDING): array {
|
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) {
|
function ($file) use ($pattern) {
|
||||||
if ($file === "." || $file === "..") return false;
|
if ($file === "." || $file === "..") return false;
|
||||||
return $pattern === null || fnmatch($pattern, $file);
|
return $pattern === null || fnmatch($pattern, $file);
|
||||||
|
|
Loading…
Reference in New Issue