Passed
Pull Request — master (#19)
by Korotkov
08:43
created

WebController::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Web;
4
5
use Rudra\Controller;
6
use App\Common\HttpErrors;
7
use App\Common\TwigFunctions;
8
//use App\Auth\Models\PDO\Users as PDO;
9
use DebugBar\DataCollector\ConfigCollector;
10
use DebugBar\DataCollector\MessagesCollector;
11
12
class WebController extends Controller
13
{
14
    use HttpErrors;
15
    use TwigFunctions;
16
17
    public function init()
18
    {
19
        $this->template(config('template', 'web'));
20
        $this->updateSessionIfSetRememberMe();
21
        $this->setData('title', 'Rudra Framework');
22
//        $this->setData('user', PDO::user());
23
    }
24
25
    /**
26
     * @param string $template
27
     * @param array  $params
28
     * @throws \Twig_Error_Loader
29
     * @throws \Twig_Error_Runtime
30
     * @throws \Twig_Error_Syntax
31
     */
32
    public function twig(string $template, array $params = []): void
33
    {
34
        $this->container()->get('debugbar')['time']->startMeasure('Controller', 'Controller');
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