Completed
Push — master ( 2edeb4...8f93c5 )
by Albert
03:04
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 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
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
    /**
15
     * {@inheritdoc}
16
     */
17
    public function setTwig(Twig_Environment $twig)
18
    {
19
        $this->twig = $twig;
20
    }
21
22
    /**
23
     * @param string $name View name
24
     * @param array  $data Data sent to view
25
     *
26
     * @return string
27
     */
28
    protected function view($name, $data = [])
29
    {
30
        return $this->twig->render($name, $data);
31
    }
32
}
33