View   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A render() 0 4 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
}
30