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

TwigFacade::addTemplatePath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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