Passed
Push — master ( db039c...4d8c20 )
by Dāvis
04:33
created

FlashExtension::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Sludio\HelperBundle\Script\Twig;
4
5
use Sludio\HelperBundle\Script\Helper\FlashAlertsHelper;
6
7
class FlashExtension extends \Twig_Extension
8
{
9
    use TwigTrait;
10
11
    private $publisher;
12
13
    /**
14
     * @var FlashAlertsHelper
15
     */
16
    private $helper;
17
18
    public function __construct($shortFunctions, $publisher, $helper)
19
    {
20
        $this->shortFunctions = $shortFunctions;
21
        $this->publisher = $publisher;
22
        $this->helper = $helper;
23
    }
24
25
    public function getAlertPublisher()
26
    {
27
        return $this->publisher;
28
    }
29
30
    public function renderFlashAlerts(array $options = [])
31
    {
32
        return $this->helper->renderFlashAlerts($options);
33
    }
34
35
    public function getFunctions()
36
    {
37
        $input = [
38
            'get_alert_publisher' => [
39
                $this,
40
                'getAlertPublisher',
41
                ['is_safe' => ['html']],
42
            ],
43
            'render_flash_alerts' => [
44
                $this,
45
                'renderFlashAlerts',
46
                ['is_safe' => ['html']],
47
            ],
48
        ];
49
50
        return $this->makeArray($input, 'function');
51
    }
52
}
53