Passed
Pull Request — master (#6)
by
unknown
01:51
created

NavigationContainer::getContainers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Everlution\Navigation\Advanced;
4
5
use Everlution\Navigation\Advanced\Item\AdvancedNavigationInterface;
6
use Everlution\Navigation\ContainerInterface;
7
8
/**
9
 * Class NavigationContainer
10
 * @author Martin Lutter <[email protected]>
11
 */
12
abstract class NavigationContainer implements AdvancedNavigationInterface
13
{
14
    /** @var ContainerInterface[] */
15
    private $containers = [];
16
17
    public function add(ContainerInterface $container): void
18
    {
19
        $this->containers[get_class($container)] = $container;
20
    }
21
22
    /**
23
     * @return ContainerInterface[]
24
     */
25
    public function getContainers(): array
26
    {
27
        return $this->containers;
28
    }
29
30
    public function get(string $name): ContainerInterface
31
    {
32
        return $this->containers[$name];
33
    }
34
}
35