Paths::getAbsFilePaths()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
nc 6
nop 1
dl 0
loc 19
rs 9.6333
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\LaravelMicroscope\FileReaders;
4
5
use Symfony\Component\Finder\Exception\DirectoryNotFoundException;
6
use Symfony\Component\Finder\Finder;
7
8
class Paths
9
{
10
    public static function getAbsFilePaths($dirs)
11
    {
12
        if (! $dirs) {
13
            return [];
14
        }
15
16
        try {
17
            $files = Finder::create()->files()->name('*.php')->in($dirs);
18
19
            $paths = [];
20
            foreach ($files as $f) {
21
                $paths[] = $f->getRealPath();
22
            }
23
24
            return $paths;
25
        } catch (DirectoryNotFoundException $e) {
26
            return [];
27
        }
28
    }
29
}
30