Completed
Pull Request — master (#244)
by Łukasz
11:47
created

ElementCollectionVisitor::visitManager()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
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
namespace FSi\Bundle\AdminBundle\Admin\Manager;
11
12
use FSi\Bundle\AdminBundle\Admin\Manager;
13
use FSi\Bundle\AdminBundle\Admin\ManagerInterface;
14
use FSi\Bundle\AdminBundle\Factory\ProductionLine;
15
16
class ElementCollectionVisitor implements Visitor
17
{
18
    /**
19
     * @var array
20
     */
21
    private $elements;
22
23
    /**
24
     * @var \FSi\Bundle\AdminBundle\Factory\ProductionLine
25
     */
26
    private $factoryProductionLine;
27
28
    public function __construct($elements = array(), ProductionLine $factoryProductionLine)
29
    {
30
        $this->elements = $elements;
31
        $this->factoryProductionLine = $factoryProductionLine;
32
    }
33
34
    /**
35
     * @param ManagerInterface $manager
36
     */
37
    public function visitManager(ManagerInterface $manager)
38
    {
39
        foreach ($this->elements as $element) {
40
            $this->factoryProductionLine->workOn($element);
41
            $manager->addElement($element);
42
        }
43
    }
44
}
45