Passed
Push — master ( 864e2a...68b437 )
by Mike
05:47
created

XervicePathFinder::getPaths()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 0
crap 3
1
<?php
2
3
4
namespace Xervice\Twig\Business\Path;
5
6
7
class XervicePathFinder implements XervicePathFinderInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    private $paths;
13
14
    /**
15
     * XervicePathFinder constructor.
16
     *
17
     * @param array $paths
18
     */
19 2
    public function __construct(array $paths)
20
    {
21 2
        $this->paths = $paths;
22 2
    }
23
24
    /**
25
     * @return array
26
     */
27 2
    public function getPaths(): array
28
    {
29 2
        $paths = [];
30 2
        foreach ($this->paths as $path) {
31 2
            if (is_dir($path)) {
32 2
                $paths = array_merge(
33 2
                    $paths,
34 2
                    glob($path . '/*')
35
                );
36
            }
37
        }
38
39 2
        return $paths;
40
    }
41
42
}