Completed
Push — next ( bd830d...51f25d )
by Thomas
16s
created

MenuSubscriber::onConfigureMenu()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 7

Duplication

Lines 16
Ratio 100 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 16
loc 16
rs 9.4285
c 1
b 1
f 0
1
<?php
2
3
namespace Oc\Index\Subscriber;
4
5
use Oc\Menu\Event\MenuEvent;
6
use Oc\Menu\MenuEnum;
7
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
8
9
/**
10
 * Class MenuSubscriber
11
 */
12 View Code Duplication
class MenuSubscriber implements EventSubscriberInterface
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...
13
{
14
    /**
15
     * Returns an array of event names this subscriber wants to listen to.
16
     *
17
     * @return array The event names to listen to
18
     */
19
    public static function getSubscribedEvents()
20
    {
21
        return [
22
            MenuEnum::MENU_MAIN => ['onConfigureMenu', 100],
23
        ];
24
    }
25
26
    /**
27
     * @param MenuEvent $event
28
     */
29
    public function onConfigureMenu(MenuEvent $event)
30
    {
31
        $event->getCurrentItem()->addChild(
32
            'Startseite',
33
            [
34
                'uri' => '/',
35
            ]
36
        );
37
38
        $event->getCurrentItem()->addChild(
39
            'Karte',
40
            [
41
                'uri' => '/map2.php',
42
            ]
43
        );
44
    }
45
}
46