BaseController::setTwig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace Frameworkless\Controllers;
3
4
use Twig_Environment;
5
use DebugBar\StandardDebugBar;
6
use Symfony\Component\HttpFoundation\Response;
7
8
/**
9
 * Description of BaseController
10
 *
11
 * @author d.lanec
12
 */
13
abstract class BaseController implements \Psr\Log\LoggerAwareInterface, PageInterface{
14
15
    /**
16
     * @var Twig_Environment
17
     */
18
    protected $twig;
19
20
    /**
21
     *
22
     * @var StandardDebugBar
23
     */
24
    protected $debugbar;
25
26
    use \Psr\Log\LoggerAwareTrait;
27
28
    protected function render($view, array $data = []){
29
30
	$debugbarRenderer = $this->debugbar->getJavascriptRenderer("/assets/debug_bar");
31
32
	$data["debugbar_Head"]	 = $debugbarRenderer->renderHead();
33
	$data["debugbar_Body"]	 = $debugbarRenderer->render();
34
35
	return $this->twig->render($view, $data);
36
    }
37
38
    public function setTwig(Twig_Environment $twig){
39
	$this->twig = $twig;
40
	return $this;
41
    }
42
43
    public function setDebugbar(StandardDebugBar $debugbar){
44
	$this->debugbar = $debugbar;
45
	return $this;
46
    }
47
}
48