XervicePathProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 15
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\Model\Path;
5
6
7
use Xervice\Core\Plugin\AbstractBusinessPlugin;
8
use Xervice\Twig\Business\Dependency\Path\PathProviderInterface;
9
use Xervice\Twig\Business\Model\Loader\XerviceLoaderInterface;
10
11
/**
12
 * @method \Xervice\Twig\Business\TwigBusinessFactory getFactory()
13
 */
14
class XervicePathProvider extends AbstractBusinessPlugin implements PathProviderInterface
15
{
16
    /**
17
     * @param \Xervice\Twig\Business\Model\Loader\XerviceLoaderInterface $loader
18
     *
19
     * @throws \Twig_Error_Loader
20
     */
21 2
    public function provideTwigPaths(XerviceLoaderInterface $loader): void
22
    {
23 2
        foreach ($this->getFactory()->createPathFinder()->getPaths() as $path) {
24 2
            if (is_dir($path . '/Presentation/Theme')) {
25 2
                $namespace = basename($path);
26 2
                $loader->addPath(
27 2
                    $path . '/Presentation/Theme',
28 2
                    $namespace
29
                );
30
            }
31
        }
32
    }
33
}