Conditions | 5 |
Paths | 9 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 5 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | 7 | public function getMediaFiles() |
|
16 | { |
||
17 | 7 | $path = $this->getBasePath(); |
|
18 | 7 | $contents = $this->getFilesystem()->listContents($path); |
|
19 | 7 | $directories = []; |
|
20 | 7 | $files = []; |
|
21 | 7 | foreach ($contents as $object) { |
|
22 | 5 | if ($object['type'] == 'dir') { |
|
23 | 1 | $directories[] = $object; |
|
24 | } else { |
||
25 | 4 | $files[] = $object; |
|
26 | } |
||
27 | } |
||
28 | 7 | if (count($directories) > 0) { |
|
29 | 1 | return $this->scanDirectoryContents($directories[0]['path']); |
|
30 | 6 | } elseif (count($files)) { |
|
31 | 4 | return $this->hydrateFileContents($files); |
|
32 | } |
||
33 | |||
34 | 2 | return []; |
|
35 | } |
||
66 |