Completed
Push — master ( 95ea77...a46709 )
by Łukasz
05:48 queued 02:19
created

View::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Tworzenieweb\SqlProvisioner\View;
4
5
use Twig_Environment;
6
use Twig_Loader_Filesystem;
7
8
class View
9
{
10
    /** @var \Twig_Environment */
11
    private $twig;
12
13
14
15
    public function __construct(string $pathToTemplates)
16
    {
17
        $loader = new Twig_Loader_Filesystem($pathToTemplates . DIRECTORY_SEPARATOR . 'templates');
18
        $this->twig = new Twig_Environment($loader, array(
19
            'cache' => '/tmp',
20
        ));
21
    }
22
23
24
25
    public function render(array $variables): string
26
    {
27
        return $this->twig->render('template.twig.html', $variables);
28
    }
29
}