Completed
Push — development ( 1b87d2...43bb99 )
by Thomas
06:02
created

htdocs/src/Oc/Menu/MenuBuilder.php (1 issue)

Severity

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\Menu;
4
5
use Knp\Menu\FactoryInterface;
6
use Oc\Menu\Event\MenuEvent;
7
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
8
9
class MenuBuilder
10
{
11
    /**
12
     * @var FactoryInterface
13
     */
14
    private $factory;
15
16
    /**
17
     * @var EventDispatcherInterface
18
     */
19
    private $eventDispatcher;
20
21
    /**
22
     * @param FactoryInterface $factory
23
     * @param EventDispatcherInterface $eventDispatcher
24
     */
25
    public function __construct(FactoryInterface $factory, EventDispatcherInterface $eventDispatcher)
26
    {
27
        $this->factory = $factory;
28
        $this->eventDispatcher = $eventDispatcher;
29
    }
30
31
    public function createMainMenu(array $options)
0 ignored issues
show
The parameter $options is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
32
    {
33
        $menu = $this->factory->createItem(MenuEnum::MENU_MAIN);
34
35
        $this->eventDispatcher->dispatch(
36
            MenuEnum::MENU_MAIN,
37
            new MenuEvent($this->eventDispatcher, $this->factory, $menu, $menu)
38
        );
39
40
        return $menu;
41
    }
42
}
43