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

XervicePathFinder   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 10
dl 0
loc 33
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getPaths() 0 13 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
}