Completed
Push — master ( ca39d5...12bd24 )
by Danny
10:03
created

SectionCollection::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 6
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 6
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
    public function __construct(array $sections = [])
18
    {
19
        foreach ($sections as $section) {
20
            $this->addSection($section);
21
        }
22
    }
23
24
    /**
25
     * @param Section $section
26
     */
27
    public function addSection(Section $section)
28
    {
29
        $this->sections[$section->getName()] = $section->getProperties();
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    public function toArray()
36
    {
37
        return $this->sections;
38
    }
39
}
40