Test Failed
Push — master ( 1e26c0...29031d )
by Ivan
02:45
created

RootNavigationItem::getRoles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Everlution\Navigation;
6
7
/**
8
 * Interface Navigation.
9
 * @author Ivan Barlog <[email protected]>
10
 */
11
class RootNavigationItem implements Item
12
{
13
    /**
14
     * @return string
15
     */
16
    public function getLabel(): string
17
    {
18
        return 'navigation root';
19
    }
20
21
    /** @var Item[] */
22
    private $children;
23
    /** @var array */
24
    private $attributes;
25
    /** @var array */
26
    private $roles;
27
28
    /**
29
     * @return array
30
     */
31
    public function getChildren(): array
32
    {
33
        return $this->children;
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getAttributes(): array
40
    {
41
        return $this->attributes;
42
    }
43
44
    /**
45
     * @return array
46
     */
47
    public function getRoles(): array
48
    {
49
        return $this->roles;
50
    }
51
52
    /**
53
     * @param Item $item
54
     * @return Item
55
     */
56
    public function addChild(Item $item)
57
    {
58
        $this->children[] = $item;
59
60
        return $this;
61
    }
62
63
    /**
64
     * @param Item $parent
65
     * @return Item
66
     * @throws \Exception
67
     */
68
    public function setParent(Item $parent)
69
    {
70
        throw new \Exception(sprintf('%s cannot have parent', self::class));
71
    }
72
73
    /**
74
     * @return Item|null
75
     */
76
    public function getParent()
77
    {
78
        return null;
79
    }
80
}
81