Completed
Push — master ( 12d04d...f0be6a )
by Albert
02:59
created

AbstractController::setTwig()   A

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 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Albert221\Blog\Controller;
4
5
use Twig_Environment;
6
7
abstract class AbstractController
8
{
9
    /**
10
     * @var Twig_Environment Twig
11
     */
12
    protected $twig;
13
14
    public function __construct(Twig_Environment $twig)
15
    {
16
        $this->twig = $twig;
17
    }
18
19
    /**
20
     * @param string $name View name
21
     * @param array  $data Data sent to view
22
     *
23
     * @return string
24
     */
25
    protected function view($name, $data = [])
26
    {
27
        return $this->twig->render($name, $data);
28
    }
29
}
30