Test Failed
Push — master ( 62d342...1e26c0 )
by Ivan
03:05
created

RootNavigationItem::getAttributes()   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
26
    /**
27
     * @return array
28
     */
29
    public function getChildren(): array
30
    {
31
        return $this->children;
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function getAttributes(): array
38
    {
39
        return $this->attributes;
40
    }
41
42
    /**
43
     * @param Item $item
44
     * @return Item
45
     */
46
    public function addChild(Item $item)
47
    {
48
        $this->children[] = $item;
49
50
        return $this;
51
    }
52
53
    /**
54
     * @param Item $parent
55
     * @return Item
56
     * @throws \Exception
57
     */
58
    public function setParent(Item $parent)
59
    {
60
        throw new \Exception(sprintf('%s cannot have parent', self::class));
61
    }
62
63
    /**
64
     * @return Item|null
65
     */
66
    public function getParent()
67
    {
68
        return null;
69
    }
70
}
71