Completed
Pull Request — master (#404)
by De Cramer
03:04
created

MenuItems   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 27
loc 27
ccs 0
cts 16
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A registerMenuItems() 16 16 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * @author    Wide Agency Dev Team
4
 * @category  eXpansion2
5
 */
6
7
namespace eXpansion\Bundle\ServerInformation\Plugins;
8
9
10
use eXpansion\Bundle\Menu\DataProviders\Listener\ListenerMenuItemProviderInterface;
11
use eXpansion\Bundle\Menu\Model\Menu\ChatCommandItem;
12
use eXpansion\Bundle\Menu\Model\Menu\ParentItem;
13
14 View Code Duplication
class MenuItems implements ListenerMenuItemProviderInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
{
16
17
    /**
18
     * Register items tot he parent item.
19
     *
20
     * @param ParentItem $root
21
     *
22
     * @return mixed
23
     */
24
    public function registerMenuItems(ParentItem $root)
25
    {
26
        $root->addChild(
27
            ParentItem::class,
28
            'general',
29
            'expansion_menu.general.label',
30
            null
31
        );
32
        $root->addChild(
33
            ChatCommandItem::class,
34
            'general/about',
35
            'expansion_server_information.menu.label',
36
            null,
37
            ['cmd' => '/info']
38
        );
39
    }
40
}
41