Passed
Push — master ( c632e6...9034d7 )
by Dāvis
05:37
created

FlashExtension::getAlertPublisher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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