AbstractController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 5
Bugs 0 Features 4
Metric Value
wmc 3
c 5
b 0
f 4
lcom 1
cbo 1
dl 0
loc 39
ccs 0
cts 12
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setTwig() 0 4 1
A setSettings() 0 4 1
A view() 0 4 1
1
<?php
2
3
namespace Albert221\Blog\Controller;
4
5
use Albert221\Blog\Repository\SettingRepositoryInterface;
6
use Twig_Environment;
7
8
abstract class AbstractController
9
{
10
    /**
11
     * @var Twig_Environment Twig
12
     */
13
    protected $twig;
14
15
    /**
16
     * @var SettingRepositoryInterface Settings
17
     */
18
    protected $settings;
19
20
    /**
21
     * @param Twig_Environment $twig
22
     */
23
    public function setTwig(Twig_Environment $twig)
24
    {
25
        $this->twig = $twig;
26
    }
27
28
    /**
29
     * @param SettingRepositoryInterface $settings
30
     */
31
    public function setSettings(SettingRepositoryInterface $settings)
32
    {
33
        $this->settings = $settings;
34
    }
35
36
    /**
37
     * @param string $name View name
38
     * @param array  $data Data sent to view
39
     *
40
     * @return string
41
     */
42
    protected function view($name, $data = [])
43
    {
44
        return $this->twig->render($name, $data);
45
    }
46
}
47