Completed
Push — development ( 0937b7...1a7c5e )
by Thomas
21s
created

src/Oc/FieldNotes/Subscriber/MenuSubscriber.php (1 issue)

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 Oc\FieldNotes\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
 * @package Oc\FieldNotes
13
 */
14 View Code Duplication
class MenuSubscriber implements EventSubscriberInterface
0 ignored issues
show
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
     * Returns an array of event names this subscriber wants to listen to.
18
     *
19
     * @return array The event names to listen to
20
     */
21
    public static function getSubscribedEvents()
22
    {
23
        return [
24
            MenuEnum::MENU_MAIN => 'onConfigureMainMenu'
25
        ];
26
    }
27
28
    /**
29
     * @param MenuEvent $event
30
     */
31
    public function onConfigureMainMenu(MenuEvent $event)
32
    {
33
        $event->getCurrentItem()->addChild(
34
            'field_notes',
35
            [
36
                'label' => 'Field-Notes',
37
                'route' => 'field_notes.index'
38
            ]
39
        );
40
    }
41
}
42