Completed
Push — master ( 2e195b...9e660e )
by
unknown
02:50
created

FakeHook::displayFakeHook()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Blast Project package.
5
 *
6
 * Copyright (C) 2015-2017 Libre Informatique
7
 *
8
 * This file is licenced under the GNU LGPL v3.
9
 * For the full copyright and license information, please view the LICENSE.md
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Blast\CoreBundle\Twig;
14
15
use Symfony\Component\DependencyInjection\ContainerInterface;
16
17
class FakeHook extends \Twig_Extension
18
{
19
    private $hookAlreadyRegistred = null;
20
21
    public function __construct(ContainerInterface $container)
22
    {
23
        $this->hookAlreadyRegistred = $container->get('twig')->hasExtension('blast_hook');
24
    }
25
26
    public function getFunctions()
27
    {
28
        $functions = [];
29
        if ($this->hookAlreadyRegistred === false) {
30
            $functions[] = new \Twig_SimpleFunction('blast_hook', array($this, 'displayFakeHook'), ['is_safe' => ['html']]);
31
        }
32
33
        return $functions;
34
    }
35
36
    public function displayFakeHook()
37
    {
38
        return '<!-- Blast hook -->';
39
    }
40
}
41