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