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

XervicePathFinder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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
}