Skip to content

Commit bdb5ad4

Browse files
authored
Update FileManagerService.php
1 parent a00a648 commit bdb5ad4

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/Service/FileManagerService.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
* @method public exists(@var string $filePath, @var bool $absolute = false): @return bool
3535
* @method public createSlug(@var string $string): @return string
3636
* @method public createFile(@var string $filename, @var string $content = '<!DOCTYPE html><html lang="en"><body style="background: #ffffff;"></body></html>'): @return void
37-
* @method public createDir(@var string $directory, @var bool $return = false): @return array
37+
* @method public createDir(@var string $directory, @var bool $returnDetails = false): @return array
3838
* @method static categorizeFiles(@var array $files, @var bool $basename = false, @var bool $path = false): @return array
3939
* @method static getExtractedFolder(@var string $folder): @return string
4040
* @method static getExtByType(@var string $type): @return array
41-
* @method public getDirs(@var string $path = '/', @var string $excludeDir = "", @var string|null $depth = '== 0'): @return array
42-
* @method public getDirsTree(@var string $path = '/', @var string $excludeDir = "", @var string|null $depth = '== 0'): @return array
41+
* @method public getDirs(@var string $path = '/', @var string $excludeDir = "", @var string|array|null $depth = '== 0'): @return array
42+
* @method public getDirsTree(@var string $path = '/', @var string $excludeDir = "", @var string|array|null $depth = '== 0'): @return array
4343
* @method static getSliceDirs(@var string|array $dirs, @var int $slice, @var bool $implode = false): @return string|array
4444
* @method public cleanDir(@var string $dir = ''): @return void
45-
* @method public getFiles(@var string $path = '/', @var ?string $depth = '== 0', @var ?string $folder = null, @var ?string $ext = null): @return array|bool
45+
* @method public getFiles(@var string $path = '/', @var string|array|null $depth = '== 0', @var ?string $folder = null, @var ?string $ext = null): @return array|bool
4646
* @method public getImageSize(@var string $filePath, @var bool $absolute = false): @return ?array
4747
* @method private getFileInfo(@var SplFileInfo $file): @return array
4848
* @method private getDimensionsFileInfo(@var string $filePath): @return array
@@ -517,7 +517,8 @@ public function createFile(string $filename, string $content = '<!DOCTYPE html><
517517
*
518518
* @return array Un tableau des répertoires créés avec leurs chemins absolus, relatifs et noms.
519519
*/
520-
public function createDir(string $directory, bool $return = false): array
520+
// public function createDir(string $directory, bool $return = false): array
521+
public function createDir(string $directory, bool $returnDetails = false): array
521522
{
522523
$outputDirectories = [];
523524

@@ -816,7 +817,8 @@ public static function getExtByType(string $type): array
816817
*
817818
* @return array Tableau des dossiers trouvés avec informations absolues et relatives.
818819
*/
819-
public function getDirs(string $path = '/', string $excludeDir = "", string|null $depth = '== 0'): array
820+
// public function getDirs(string $path = '/', string $excludeDir = "", string|null $depth = '== 0'): array
821+
public function getDirs(string $path = '/', string $excludeDir = "", string|array|null $depth = '== 0'): array
820822
{
821823
$realPath = \realpath($this->getDefaultDirectory() . '/' . \trim($path, '/'));
822824

@@ -825,7 +827,8 @@ public function getDirs(string $path = '/', string $excludeDir = "", string|null
825827
}
826828

827829
$finder = new Finder();
828-
if ($depth) {
830+
// if ($depth) {
831+
if ($depth !== null) {
829832
$finder->depth($depth); // Search only folders at the given depth $depth
830833
}
831834
$finder->directories()->in($realPath); // Search only folders at the root
@@ -884,7 +887,8 @@ public function getDirs(string $path = '/', string $excludeDir = "", string|null
884887
*
885888
* @return array Tableau arborescent des dossiers avec informations absolues, relatives et enfants.
886889
*/
887-
public function getDirsTree(string $path = '/', string $excludeDir = "", string|null $depth = '== 0'): array
890+
// public function getDirsTree(string $path = '/', string $excludeDir = "", string|null $depth = '== 0'): array
891+
public function getDirsTree(string $path = '/', string $excludeDir = "", string|array|null $depth = '== 0'): array
888892
{
889893
// $trimedPath = \trim($path, '/');
890894
// $realPath = \realpath($this->getDefaultDirectory() . '/' . $trimedPath);
@@ -895,7 +899,8 @@ public function getDirsTree(string $path = '/', string $excludeDir = "", string|
895899
}
896900

897901
$finder = new Finder();
898-
if ($depth) {
902+
// if ($depth) {
903+
if ($depth !== null) {
899904
$finder->depth($depth); // Search only folders at the given depth $depth
900905
}
901906
$finder->directories()->in($realPath); // Search only folders at the root
@@ -1039,7 +1044,8 @@ public function cleanDir(string $dir = ''): void
10391044
*
10401045
* @return array|bool Tableau des fichiers avec informations détaillées, ou false si aucun fichier trouvé.
10411046
*/
1042-
public function getFiles(string $path = '/', ?string $depth = '== 0', ?string $folder = null, ?string $ext = null): array|bool
1047+
// public function getFiles(string $path = '/', ?string $depth = '== 0', ?string $folder = null, ?string $ext = null): array|bool
1048+
public function getFiles(string $path = '/', string|array|null $depth = '== 0', ?string $folder = null, ?string $ext = null): array|bool
10431049
{
10441050
// $trimedPath = \trim($path, '/');
10451051
// $realPath = \realpath(\rtrim($this->getDefaultDirectory(), '/') . '/' . $trimedPath);
@@ -1050,7 +1056,8 @@ public function getFiles(string $path = '/', ?string $depth = '== 0', ?string $f
10501056
}
10511057

10521058
$finder = new Finder();
1053-
if ($depth) {
1059+
// if ($depth) {
1060+
if ($depth !== null) {
10541061
$finder->depth($depth); // $finder->depth(['== 0']);
10551062
}
10561063
$finder->files()->in($realPath); // $finder->files()->in($realPath)->depth('== 0');

0 commit comments

Comments
 (0)