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

NavigationContainer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 21
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 3 1
A add() 0 3 1
A getContainers() 0 3 1
1
<?php
2
3
namespace Everlution\Navigation\ContainerBuilder;
4
5
use Everlution\Navigation\ContainerInterface;
6
7
/**
8
 * Class NavigationContainer
9
 * @author Martin Lutter <[email protected]>
10
 */
11
abstract class NavigationContainer implements AdvancedNavigationInterface
12
{
13
    /** @var ContainerInterface[] */
14
    private $containers = [];
15
16
    public function add(ContainerInterface $container): void
17
    {
18
        $this->containers[get_class($container)] = $container;
19
    }
20
21
    /**
22
     * @return ContainerInterface[]
23
     */
24
    public function getContainers(): array
25
    {
26
        return $this->containers;
27
    }
28
29
    public function get(string $name): ContainerInterface
30
    {
31
        return $this->containers[$name];
32
    }
33
}
34