Completed
Push — master ( aba493...5356ed )
by Ruud
315:38 queued 305:00
created

Kunstmaan/AdminBundle/Twig/MenuTwigExtension.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminBundle\Twig;
4
5
use Kunstmaan\AdminBundle\Helper\AdminPanel\AdminPanel;
6
use Kunstmaan\AdminBundle\Helper\AdminPanel\AdminPanelActionInterface;
7
use Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder;
8
9
class MenuTwigExtension extends \Twig_Extension
10
{
11
    /**
12
     * @var MenuBuilder
13
     */
14
    protected $menuBuilder;
15
16
    /**
17
     * @var AdminPanel
18
     */
19
    protected $adminPanel;
20
21
    /**
22
     * @param MenuBuilder $menuBuilder
23
     * @param AdminPanel  $adminPanel
24
     */
25
    public function __construct(MenuBuilder $menuBuilder, AdminPanel $adminPanel)
26
    {
27
        $this->menuBuilder = $menuBuilder;
28
        $this->adminPanel = $adminPanel;
29
    }
30
31
    /**
32
     * Get Twig functions defined in this extension.
33
     *
34
     * @return array
35
     */
36
    public function getFunctions()
37
    {
38
        return array(
39
            new \Twig_SimpleFunction('get_admin_menu', array($this, 'getAdminMenu')),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
40
            new \Twig_SimpleFunction('get_admin_panel_actions', array($this, 'getAdminPanelActions')),
0 ignored issues
show
Deprecated Code introduced by
The class Twig_SimpleFunction has been deprecated with message: since Twig 2.7, use "Twig\TwigFunction" instead

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
41
        );
42
    }
43
44
    /**
45
     * Return the admin menu MenuBuilder.
46
     *
47
     * @return MenuBuilder
48
     */
49
    public function getAdminMenu()
50
    {
51
        return $this->menuBuilder;
52
    }
53
54
    /**
55
     * Return the admin panel actions.
56
     *
57
     * @return AdminPanelActionInterface[]
58
     */
59
    public function getAdminPanelActions()
60
    {
61
        return $this->adminPanel->getAdminPanelActions();
62
    }
63
}
64