TwigResolver   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setViewEngineConfig() 0 4 1
A resolve() 0 9 2
1
<?php
2
3
namespace App\ViewResolver;
4
5
use Core\View\ViewResolverInterface;
6
use App\ViewEngine\TwigView;
7
8
class TwigResolver implements ViewResolverInterface
9
{
10
    protected $settings = [];
11
12
    public function setViewEngineConfig(array $settings)
13
    {
14
        $this->settings = $settings;
15
    }
16
17
    public function resolve($viewData)
18
    {
19
        if (is_string($viewData)) {
20
            $view = new TwigView($this->settings);
21
            $view->file($viewData);
22
23
            return $view;
24
        }
25
    }
26
}
27