AbstractController::view()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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