Passed
Push — master ( 68b437...eb1a97 )
by Mike
08:08
created

XervicePathProvider::provideTwigPaths()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

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