| Conditions | 6 |
| Paths | 5 |
| Total Lines | 29 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function locateAll() |
||
| 16 | { |
||
| 17 | $res = []; |
||
| 18 | |||
| 19 | // no paths for files specified - no files to locate |
||
| 20 | if (!is_array($this->paths)) { |
||
| 21 | return $res; |
||
| 22 | } |
||
| 23 | |||
| 24 | // traverse over all paths specified for search in locator |
||
| 25 | foreach ($this->paths as $path) { |
||
| 26 | // fetch entries in each path |
||
| 27 | $dir_entries = scandir($path); |
||
| 28 | foreach ($dir_entries as $dir_entry) { |
||
| 29 | // include paths to files into result set |
||
| 30 | $filename = $path . DIRECTORY_SEPARATOR . $dir_entry; |
||
| 31 | if (@is_file($filename) && @is_readable($filename)) { |
||
| 32 | $res[] = $filename; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | // here $res is an array of paths to files |
||
| 38 | // make files in res set unique |
||
| 39 | $res = array_unique($res); |
||
| 40 | |||
| 41 | // return array of file paths |
||
| 42 | return $res; |
||
| 43 | } |
||
| 44 | } |
||
| 45 |