GeneratorContainer::__construct()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
c 1
b 0
f 1
dl 0
loc 12
rs 10
cc 4
nc 4
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Everlution\Navigation;
6
7
use Everlution\Navigation\Item\GeneratorInterface;
8
9
class GeneratorContainer extends MutableContainer
10
{
11
    public function __construct(ContainerInterface $container)
12
    {
13
        foreach ($container->getItems() as $item) {
14
            if ($item instanceof GeneratorInterface) {
15
                foreach ($item->generate() as $generatedItem) {
16
                    $this->add($generatedItem);
17
                }
18
19
                continue;
20
            }
21
22
            $this->add($item);
23
        }
24
    }
25
}
26