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

MenuBuilder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A createMainMenu() 0 11 1
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