1 | <?php |
||
8 | class ReadDirectory |
||
9 | { |
||
10 | /** |
||
11 | * @var string $calledClass : Name of the current class. |
||
12 | * For recall the correct class when she's extended. |
||
13 | */ |
||
14 | protected $calledClass = ''; |
||
15 | |||
16 | /** |
||
17 | * @var array $list : List all path found |
||
18 | */ |
||
19 | protected $list; |
||
20 | |||
21 | /** |
||
22 | * @var array $ignore : Item to ignore during the reading of directories |
||
23 | */ |
||
24 | private $ignore = ['.', '..']; |
||
25 | |||
26 | /* |
||
27 | * Constructeur |
||
28 | * |
||
29 | * @param array &$listFiles : List of file(s) found |
||
30 | */ |
||
31 | public function __construct(&$listFiles) |
||
36 | |||
37 | /** |
||
38 | * Read all the directories |
||
39 | * |
||
40 | * @param string $path : Path to read |
||
41 | * |
||
42 | * @return void |
||
43 | */ |
||
44 | public function run($path) |
||
70 | |||
71 | /** |
||
72 | * Action to do when a file is found. |
||
73 | * |
||
74 | * @param string $fileName The file's name |
||
75 | * @param string $pathToFile The file's path |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | protected function fileAction($fileName, $pathToFile) |
||
85 | |||
86 | /** |
||
87 | * Recall ReadDirectory to read this directory |
||
88 | * This is to avoid having the recursion error |
||
89 | * |
||
90 | * @param string $directory |
||
91 | */ |
||
92 | protected function dirAction($directory) |
||
97 | } |
||
98 |