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

XervicePathProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 16
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A provideTwigPaths() 0 8 3
1
<?php
2
3
4
namespace Xervice\Twig\Business\Path;
5
6
7
use Symfony\Component\Finder\Finder;
8
use Xervice\Core\Locator\AbstractWithLocator;
9
use Xervice\Twig\Business\Loader\XerviceLoaderInterface;
10
11
/**
12
 * @method \Xervice\Twig\TwigFactory getFactory()
13
 */
14
class XervicePathProvider extends AbstractWithLocator implements PathProviderInterface
15
{
16
    /**
17
     * @param \Xervice\Twig\Business\Loader\XerviceLoaderInterface $loader
18
     *
19
     * @throws \Core\Locator\Dynamic\ServiceNotParseable
20
     * @throws \Twig_Error_Loader
21
     */
22 2
    public function provideTwigPaths(XerviceLoaderInterface $loader): void
23
    {
24 2
        foreach ($this->getFactory()->createPathFinder()->getPaths() as $path) {
25 2
            if (is_dir($path . '/Presentation/Theme')) {
26 2
                $namespace = basename($path);
27 2
                $loader->addPath(
28 2
                    $path . '/Presentation/Theme',
29 2
                    $namespace
30
                );
31
            }
32
        }
33
    }
34
}