Completed
Push — master ( e09c01...ac9146 )
by De Cramer
02:18 queued 02:12
created

MenuItems   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 111
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 111
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B registerMenuItems() 0 101 1
1
<?php
2
3
namespace eXpansion\Bundle\Menu\Plugins;
4
5
use eXpansion\Bundle\Menu\DataProviders\Listener\ListenerMenuItemProviderInterface;
6
use eXpansion\Bundle\Menu\Model\Menu\ChatCommandItem;
7
use eXpansion\Bundle\Menu\Model\Menu\ParentItem;
8
use FML\Controls\Quads\Quad_Icons64x64_1;
9
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
10
11
/**
12
 * Class MenuItems
13
 *
14
 * @author    de Cramer Oliver<[email protected]>
15
 * @copyright 2017 Smile
16
 * @package eXpansion\Bundle\Menu\Plugins
17
 */
18
class MenuItems implements ListenerMenuItemProviderInterface
19
{
20
    /**
21
     * Register items tot he parent item.
22
     *
23
     * @param ParentItem $root
24
     *
25
     * @return mixed
26
     */
27
    public function registerMenuItems(ParentItem $root)
28
    {
29
        $root->addChild(
30
            ParentItem::class,
31
            'admin',
32
            'expansion_menu.admin.label',
33
            null // Permission are handled by sub elements.
34
        );
35
        $root->addChild(
36
            ChatCommandItem::class,
37
            'admin/help',
38
            'expansion_menu.admin.help',
39
            'admin',
40
            ['cmd' => '/help']
41
        );
42
        $root->addChild(
43
            ChatCommandItem::class,
44
            'admin/script_settings',
45
            'expansion_menu.admin.script_settings',
46
            'admin',
47
            ['cmd' => '/admin script']
48
        );
49
        $root->addChild(
50
            ChatCommandItem::class,
51
            'admin/server_settings',
52
            'expansion_menu.admin.server_settings',
53
            'admin',
54
            ['cmd' => '/admin server']
55
        );
56
57
        /*
58
         * @TODO put these in plugins that actually defines the commands.
59
         */
60
        $root->addChild(
61
            ParentItem::class,
62
            'map',
63
            'expansion_menu.map.label',
64
            null // Permission are handled by sub elements.
65
        );
66
        $root->addChild(
67
            ChatCommandItem::class,
68
            'map/list',
69
            'expansion_menu.map.list',
70
            '',
71
            ['cmd' => '/list']
72
        );
73
        $root->addChild(
74
            ChatCommandItem::class,
75
            'map/mx',
76
            'expansion_menu.map.mx',
77
            '',
78
            ['cmd' => '/mx']
79
        );
80
        $root->addChild(
81
            ChatCommandItem::class,
82
            'map/recs',
83
            'expansion_menu.map.recs',
84
            '',
85
            ['cmd' => '/recs']
86
        );
87
88
        /**
89
         * Test sub and subs.
90
         *
91
         */
92
        $root->addChild(
93
            ParentItem::class,
94
            'admin/sub',
95
            'expansion_menu.admin.sub1',
96
            'admin',
97
            []
98
        );
99
        $root->addChild(
100
            ParentItem::class,
101
            'admin/sub/sub',
102
            'expansion_menu.admin.sub2',
103
            'admin',
104
            []
105
        );
106
        $root->addChild(
107
            ChatCommandItem::class,
108
            'admin/sub/sub_button',
109
            'expansion_menu.map.recs',
110
            '',
111
            ['cmd' => '/recs']
112
        );
113
        $root->addChild(
114
            ParentItem::class,
115
            'admin/sub/sub/sub',
116
            'expansion_menu.admin.sub3',
117
            'admin',
118
            []
119
        );
120
        $root->addChild(
121
            ChatCommandItem::class,
122
            'admin/sub/sub/sub_button',
123
            'expansion_menu.map.recs',
124
            '',
125
            ['cmd' => '/recs']
126
        );
127
    }
128
}