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

SectionCollection   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 33
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A addSection() 0 4 1
A toArray() 0 4 1
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