FileHelper::findFiles()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 14
ccs 9
cts 9
cp 1
rs 9.4285
c 1
b 0
f 0
cc 3
eloc 7
nc 4
nop 2
crap 3
1
<?php
2
3
namespace Padosoft\LaravelComposerSecurity;
4
5
6
class FileHelper
7
{
8
    /**
9
     * @param $path
10
     * @param $fileName
11
     * @return array
12
     *
13
     */
14 20
    public function findFiles($path, $fileName)
15
    {
16 20
        if ($path=='') {
17 2
            $path = base_path();
18 2
        }
19
20 20
        if (is_dir($path)) {
21 20
            $path=str_finish($path, '/');
22
23 20
        }
24 20
        $path .= $fileName;
25
26 20
        return glob($path);
27
    }
28
29 20
    public static function adjustPath($path)
30
    {
31
32 20
        if ($path == '') {
33 4
            return array();
34
        }
35
36 20
        $p = explode(",", str_replace('\\', '/', $path));
37
38 20
        $pathList = array_map(function ($item) {
39 20
            return str_finish($item, '/');
40 20
        },
41
            $p
42 20
        );
43
44 20
        return $pathList;
45
    }
46
}
47