| Total Complexity | 16 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class RecursiveFileListing { |
||
| 8 | |||
| 9 | private $root_dir; |
||
| 10 | private $files; |
||
| 11 | private $filters = []; |
||
| 12 | |||
| 13 | 12 | public function __construct(string $dir) { |
|
| 14 | 12 | if (!is_dir($dir)) { |
|
| 15 | 3 | throw new Exception("Directory required"); |
|
| 16 | } |
||
| 17 | |||
| 18 | 9 | $this->root_dir = $dir; |
|
| 19 | 9 | } |
|
| 20 | |||
| 21 | 6 | public function addFilter(string $regex) { |
|
| 23 | 6 | } |
|
| 24 | |||
| 25 | 3 | public function clearFilters() { |
|
| 27 | 3 | } |
|
| 28 | |||
| 29 | 9 | public function scan() : array { |
|
| 30 | 9 | $this->files = []; |
|
| 31 | 9 | $this->recursiveScan($this->root_dir); |
|
| 32 | 9 | sort($this->files); |
|
| 33 | 9 | return $this->files; |
|
| 34 | } |
||
| 35 | |||
| 36 | 9 | private function recursiveScan(string $dir) { |
|
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | 9 | } |
|
| 49 | |||
| 50 | 9 | private function isFileOk(string $path) : bool { |
|
| 65 |