Completed
Push — master ( 3bb683...8cf661 )
by Korotkov
01:35
created

WebController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 7

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 9 1
A after() 0 4 1
A twig() 0 8 1
1
<?php
2
3
namespace App\Web;
4
5
use DebugBar\DataCollector\ConfigCollector;
6
use DebugBar\DataCollector\MessagesCollector;
7
use App\Web\Supports\HttpErrors;
8
use App\Web\Supports\TwigFunctions;
9
use Rudra\Controller;
10
use Rudra\ContainerInterface;
11
12
class WebController extends Controller
13
{
14
15
    use TwigFunctions;
16
    use HttpErrors;
17
18
    public function init(ContainerInterface $container, array $templateEngine)
19
    {
20
        parent::init($container, $container->config('template'));
21
22
        $this->getTwig()->addGlobal('container', $this->container());
23
        $this->container()->get('debugbar')['time']->startMeasure('Controller', 'Controller');
24
        $this->setData('Rudra Framework', 'title');
25
        $this->check();
26
    }
27
28
    public function after()
29
    {
30
31
    }
32
33
    public function twig(string $template, array $params = []): void
34
    {
35
        $this->container()->get('debugbar')->addCollector(new ConfigCollector($params));
36
        $this->container()->get('debugbar')->addCollector(new MessagesCollector('Twig'));
37
        $this->container()->get('debugbar')['Twig']->info($template);
38
39
        parent::twig($template, $params);
40
    }
41
}
42