ElementCollectionVisitor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A visitManager() 0 5 2
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace FSi\Bundle\AdminBundle\Admin\Manager;
13
14
use FSi\Bundle\AdminBundle\Admin\Element;
15
use FSi\Bundle\AdminBundle\Admin\ManagerInterface;
16
use FSi\Bundle\AdminBundle\Factory\ProductionLine;
17
18
class ElementCollectionVisitor implements Visitor
19
{
20
    /**
21
     * @var Element[]
22
     */
23
    private $elements;
24
25
    /**
26
     * @var ProductionLine
27
     */
28
    private $factoryProductionLine;
29
30
    /**
31
     * @param Element[] $elements
32
     * @param ProductionLine $factoryProductionLine
33
     */
34
    public function __construct(array $elements = [], ProductionLine $factoryProductionLine)
35
    {
36
        $this->elements = $elements;
37
        $this->factoryProductionLine = $factoryProductionLine;
38
    }
39
40
    public function visitManager(ManagerInterface $manager): void
41
    {
42
        foreach ($this->elements as $element) {
43
            $this->factoryProductionLine->workOn($element);
44
            $manager->addElement($element);
45
        }
46
    }
47
}
48