Completed
Push — master ( 1b2525...eaa10a )
by Albert
11:28
created

AbstractController::view()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace Albert221\Blog\Controller;
4
5
use Albert221\Blog\Twig\TwigAwareInterface;
6
7
abstract class AbstractController implements TwigAwareInterface
8
{
9
    /**
10
     * @var \Twig_Environment Twig
11
     */
12
    protected $twig;
13
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function setTwig($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
}