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

TwigFacade   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
eloc 3
dl 0
loc 22
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 3 1
A addTemplatePath() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
5
namespace Xervice\Twig;
6
7
8
use Xervice\Core\Facade\AbstractFacade;
9
10
/**
11
 * @method \Xervice\Twig\TwigFactory getFactory()
12
 * @method \Xervice\Twig\TwigConfig getConfig()
13
 */
14
class TwigFacade extends AbstractFacade
15
{
16
    /**
17
     * @param string $template
18
     * @param array $params
19
     *
20
     * @return string
21
     * @throws \Twig_Error_Loader
22
     * @throws \Twig_Error_Runtime
23
     * @throws \Twig_Error_Syntax
24
     */
25 2
    public function render(string $template, array $params = []): string
26
    {
27 2
        return $this->getFactory()->getTwigEnvironment()->render($template, $params);
28
    }
29
30
    /**
31
     * @param string $path
32
     */
33
    public function addTemplatePath(string $path): void
34
    {
35
        $this->getFactory()->createPathInjector()->addPath($path);
36
    }
37
}