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

SectionCollection::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
    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