Completed
Pull Request — master (#151)
by De Cramer
03:02
created

MenuItems   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 42
ccs 0
cts 25
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B registerMenuItems() 0 31 1
1
<?php
2
3
4
namespace eXpansion\Bundle\AdminChat\Plugins;
5
6
use eXpansion\Bundle\Menu\DataProviders\Listener\ListenerMenuItemProviderInterface;
7
use eXpansion\Bundle\Menu\Model\Menu\ChatCommandItem;
8
use eXpansion\Bundle\Menu\Model\Menu\ParentItem;
9
10
11
/**
12
 * Class MenuItems
13
 *
14
 * @package eXpansion\Bundle\AdminChat\Plugins;
15
 * @author  oliver de Cramer <[email protected]>
16
 */
17
class MenuItems implements ListenerMenuItemProviderInterface
18
{
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
36
        $root->addChild(
37
            ChatCommandItem::class,
38
            'admin/restartmap',
39
            'expansion_admin_chat.restartmap.label',
40
            'restart',
41
            ['cmd' => '/admin restart']
42
        );
43
        $root->addChild(
44
            ChatCommandItem::class,
45
            'admin/nextmap',
46
            'expansion_admin_chat.nextmap.label',
47
            'next',
48
            ['cmd' => '/admin next']
49
        );
50
        $root->addChild(
51
            ChatCommandItem::class,
52
            'admin/cancel',
53
            'expansion_admin_chat.cancel.label',
54
            'votes',
55
            ['cmd' => '/admin cancel']
56
        );
57
    }
58
}