Completed
Push — master ( c330ed...f92166 )
by Korotkov
02:57 queued 01:26
created

HttpController::twig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace App\Http;
4
5
use DebugBar\DataCollector\ConfigCollector;
6
use DebugBar\DataCollector\MessagesCollector;
7
use App\Http\Supports\HttpErrors;
8
use App\Http\Supports\TwigFunctions;
9
use Rudra\ContainerInterface;
10
use Rudra\Controller;
11
12
/**
13
 * Class Module
14
 *
15
 * @package Http
16
 */
17
class HttpController extends Controller
18
{
19
20
    use TwigFunctions;
21
    use HttpErrors;
22
23
    /**
24
     * @param ContainerInterface $container
25
     * @param string             $templateEngine
26
     */
27
    public function init(ContainerInterface $container, string $templateEngine)
28
    {
29
        parent::init($container, $templateEngine);
30
31
        $this->container()->get('debugbar')['time']->startMeasure('Controller', 'Controller');
32
        $this->setData($this->container()->config('title'), 'title');
33
        $this->setData($this->container(), 'container');
34
        $this->check();
35
    }
36
37
    public function twig(string $template, array $params = []): void
38
    {
39
        $this->container()->get('debugbar')->addCollector(new ConfigCollector($params));
40
        $this->container()->get('debugbar')->addCollector(new MessagesCollector('Twig'));
41
        $this->container()->get('debugbar')['Twig']->info($template);
42
43
        parent::twig($template, $params); // TODO: Change the autogenerated stub
44
    }
45
}
46