ConfigureMenuEvent::setMenu()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace SumoCoders\FrameworkCoreBundle\Event;
4
5
use Knp\Menu\FactoryInterface;
6
use Knp\Menu\ItemInterface;
7
use Symfony\Component\EventDispatcher\Event;
8
9
class ConfigureMenuEvent extends Event
10
{
11
    const EVENT_NAME = 'framework_core.configure_menu';
12
13
    /**
14
     * @var \Knp\Menu\FactoryInterface
15
     */
16
    private $factory;
17
18
    /**
19
     * @var \Knp\Menu\ItemInterface
20
     */
21
    private $menu;
22
23
    /**
24
     * @param FactoryInterface $factory
25
     * @param ItemInterface    $menu
26
     */
27 13
    public function __construct(FactoryInterface $factory, ItemInterface $menu)
28
    {
29 13
        $this->setFactory($factory);
30 13
        $this->setMenu($menu);
31 13
    }
32
33
    /**
34
     * @param FactoryInterface $factory
35
     */
36 13
    private function setFactory($factory)
37
    {
38 13
        $this->factory = $factory;
39 13
    }
40
41
    /**
42
     * @return \Knp\Menu\FactoryInterface
43
     */
44 1
    public function getFactory()
45
    {
46 1
        return $this->factory;
47
    }
48
49
    /**
50
     * @param ItemInterface $menu
51
     */
52 13
    private function setMenu($menu)
53
    {
54 13
        $this->menu = $menu;
55 13
    }
56
57
    /**
58
     * @return \Knp\Menu\ItemInterface
59
     */
60 9
    public function getMenu()
61
    {
62 9
        return $this->menu;
63
    }
64
}
65