1 | <?php |
||
24 | class Enumerator |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Path to the root directory, where enumeration should start |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $rootDirectory; |
||
33 | |||
34 | /** |
||
35 | * List of additional include paths, should be below rootDirectory |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | private $includePaths; |
||
40 | |||
41 | /** |
||
42 | * List of additional exclude paths, should be below rootDirectory |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | private $excludePaths; |
||
47 | |||
48 | /** |
||
49 | * Initializes an enumerator |
||
50 | * |
||
51 | * @param string $rootDirectory Path to the root directory |
||
52 | * @param array $includePaths List of additional include paths |
||
53 | * @param array $excludePaths List of additional exclude paths |
||
54 | */ |
||
55 | 7 | public function __construct($rootDirectory, array $includePaths = [], array $excludePaths = []) |
|
61 | |||
62 | /** |
||
63 | * Returns an enumerator for files |
||
64 | * |
||
65 | * @return CallbackFilterIterator|RecursiveIteratorIterator|\IteratorIterator|SplFileInfo[] |
||
66 | * @throws UnexpectedValueException |
||
67 | * @throws InvalidArgumentException |
||
68 | * @throws LogicException |
||
69 | */ |
||
70 | 7 | public function enumerate() |
|
96 | |||
97 | 7 | private function dumpForAppVeyor($iterator) |
|
105 | |||
106 | /** |
||
107 | * @return array |
||
108 | * @throws UnexpectedValueException |
||
109 | */ |
||
110 | 7 | private function getInPaths() |
|
129 | |||
130 | /** |
||
131 | * @return array |
||
132 | */ |
||
133 | 7 | private function getExcludePaths() |
|
144 | |||
145 | /** |
||
146 | * Returns a filter callback for enumerating files |
||
147 | * |
||
148 | * @return \Closure |
||
149 | */ |
||
150 | 7 | public function getFilter() |
|
190 | |||
191 | /** |
||
192 | * Return the real path of the given file |
||
193 | * |
||
194 | * This is used for testing purpose with virtual file system. |
||
195 | * In a vfs the 'realPath' methode will always return false. |
||
196 | * So we have a chance to mock this single function to return different path. |
||
197 | * |
||
198 | * @param SplFileInfo $file |
||
199 | * |
||
200 | * @return string |
||
201 | */ |
||
202 | 1 | protected function getFileFullPath(SplFileInfo $file) |
|
206 | |||
207 | } |
||
208 |