Code Duplication    Length = 40-41 lines in 2 locations

app/Http/Supports/TwigFunctions.php 1 location

@@ 12-51 (lines=40) @@
9
trait TwigFunctions
10
{
11
12
    public function templateEngine(string $config): void
13
    {
14
        parent::templateEngine($config);
15
16
        $d = new Twig_SimpleFunction('d', function ($var) {
17
            return d($var);
18
        });
19
20
        $this->getTwig()->addFunction($d);
21
22
        $date = new Twig_SimpleFunction('date', function ($var) {
23
            return date($var);
24
        });
25
26
        $this->getTwig()->addFunction($date);
27
28
        $auth = new Twig_SimpleFunction('auth', function () {
29
            return $this->container()->get('auth')->access(true);
30
        });
31
32
        $this->getTwig()->addFunction($auth);
33
34
35
        $active = new Twig_SimpleFunction('active', function ($var) {
36
            return $this->container()->get('pagination')->activeClass($var);
37
        });
38
39
        $this->getTwig()->addFunction($active);
40
41
        $strstr = new Twig_SimpleFunction('strstr', function ($var) {
42
            return strstr($var, '<a id="strstr" name="strstr"></a>', true);
43
        });
44
45
        $this->getTwig()->addFunction($strstr);
46
47
        if (DEV) {
48
            $debugBarRenderer = $this->container()->get('debugbar')->getJavascriptRenderer();
49
            $this->getTwig()->addGlobal('debugbar', $debugBarRenderer);
50
        }
51
    }
52
53
    /**
54
     * @return Twig_Environment

app/Http/HttpController.php 1 location

@@ 42-82 (lines=41) @@
39
        $this->container()->unsetSession('alert');
40
    }
41
42
    public function templateEngine(string $config): void
43
    {
44
        parent::templateEngine($config);
45
46
        $d = new \Twig_SimpleFunction('d', function ($var) {
47
            return d($var);
48
        });
49
50
        $this->getTwig()->addFunction($d);
51
52
        $date = new \Twig_SimpleFunction('date', function ($var) {
53
            return date($var);
54
        });
55
56
        $this->getTwig()->addFunction($date);
57
58
        $auth = new \Twig_SimpleFunction('auth', function () {
59
            return $this->container()->get('auth')->regularAccess();
60
        });
61
62
        $this->getTwig()->addFunction($auth);
63
64
65
        $active = new \Twig_SimpleFunction('active', function ($var) {
66
            return $this->container()->get('pagination')->activeClass($var);
67
        });
68
69
        $this->getTwig()->addFunction($active);
70
71
        $strstr = new \Twig_SimpleFunction('strstr', function ($var) {
72
            return strstr($var, '<a id="strstr" name="strstr"></a>', true);
73
        });
74
75
        $this->getTwig()->addFunction($strstr);
76
77
        if (DEV) {
78
            $debugbarRenderer = Container::$app->get('debugbar')->getJavascriptRenderer();
79
            $this->getTwig()->addGlobal('debugbar', $debugbarRenderer);
80
        }
81
82
    }
83
84
    public function error404()
85
    {