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

MenuBuilder::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
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
Unused Code introduced by
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