NavigationCollection   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 13
c 2
b 0
f 0
dl 0
loc 37
ccs 0
cts 16
cp 0
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getIcon() 0 3 1
A addToCollection() 0 4 1
A __construct() 0 5 1
A getCollection() 0 3 1
A __toArray() 0 3 1
1
<?php
2
3
namespace Obblm\Core\Twig\Parts;
4
5
class NavigationCollection implements NavigationElementInterface
6
{
7
    protected $collection = [];
8
    protected $name = null;
9
    protected $icon = null;
10
11
    public function __construct($name = null, $icon = null, array $collection = [])
12
    {
13
        $this->collection = $collection;
14
        $this->name = $name;
15
        $this->icon = $icon;
16
    }
17
18
    public function getName(): ?string
19
    {
20
        return $this->name;
21
    }
22
23
    public function getIcon(): ?string
24
    {
25
        return $this->icon;
26
    }
27
28
    public function getCollection(): array
29
    {
30
        return $this->collection;
31
    }
32
33
    public function addToCollection(NavigationElementInterface $item): self
34
    {
35
        $this->collection[] = $item;
36
        return $this;
37
    }
38
39
    public function __toArray(): array
40
    {
41
        return (array) $this->collection;
42
    }
43
}
44