BaseController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A render() 0 9 1
A setTwig() 0 4 1
A setDebugbar() 0 4 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