Completed
Push — master ( 12bd24...1184b8 )
by Danny
03:40
created

SectionCollection::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
namespace MyOnlineStore\Bundle\RabbitMqManagerBundle\Configuration\Section;
4
5
use Supervisor\Configuration\Section;
6
7
final class SectionCollection
8
{
9
    /**
10
     * @var Section[]
11
     */
12
    private $sections;
13
14
    /**
15
     * @param Section[] $sections
16
     */
17 5
    public function __construct(array $sections = [])
18
    {
19 5
        foreach ($sections as $section) {
20 1
            $this->addSection($section);
21 5
        }
22 5
    }
23
24
    /**
25
     * @param Section $section
26
     */
27 5
    public function addSection(Section $section)
28
    {
29 5
        $this->sections[$section->getName()] = $section->getProperties();
30 5
    }
31
32
    /**
33
     * @return array
34
     */
35 1
    public function toArray()
36
    {
37 1
        return $this->sections;
38
    }
39
}
40