1 | <?php |
||
20 | class Enumerator |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Path to the root directory, where enumeration should start |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | private $rootDirectory; |
||
29 | |||
30 | /** |
||
31 | * List of additional include paths, should be below rootDirectory |
||
32 | * |
||
33 | * @var array |
||
34 | */ |
||
35 | private $includePaths; |
||
36 | |||
37 | /** |
||
38 | * List of additional exclude paths, should be below rootDirectory |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | private $excludePaths; |
||
43 | |||
44 | /** |
||
45 | * Initializes an enumerator |
||
46 | * |
||
47 | * @param string $rootDirectory Path to the root directory |
||
48 | * @param array $includePaths List of additional include paths |
||
49 | * @param array $excludePaths List of additional exclude paths |
||
50 | */ |
||
51 | 7 | public function __construct(string $rootDirectory, array $includePaths = [], array $excludePaths = []) |
|
57 | |||
58 | /** |
||
59 | * Returns an enumerator for files |
||
60 | * |
||
61 | * @return \CallbackFilterIterator|\RecursiveIteratorIterator|SplFileInfo[] |
||
62 | */ |
||
63 | 7 | public function enumerate() |
|
77 | |||
78 | /** |
||
79 | * Returns a filter callback for enumerating files |
||
80 | */ |
||
81 | 7 | public function getFilter() : Closure |
|
121 | |||
122 | /** |
||
123 | * Return the real path of the given file |
||
124 | * |
||
125 | * This is used for testing purpose with virtual file system. |
||
126 | * In a vfs the 'realPath' methode will always return false. |
||
127 | * So we have a chance to mock this single function to return different path. |
||
128 | * |
||
129 | * @param SplFileInfo $file |
||
130 | * |
||
131 | * @return string |
||
132 | */ |
||
133 | 1 | protected function getFileFullPath(SplFileInfo $file) : string |
|
137 | |||
138 | } |
||
139 |