Map::__construct()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Cascade\Mapper\Map;
4
5
use Cascade\Mapper\Mapping\MappingInterface;
6
7
class Map implements MapInterface
8
{
9
    /**
10
     * @var MappingInterface[]
11
     */
12
    private $mappings = [];
13
14
    /**
15
     * @param MappingInterface[] $mappings
16
     */
17 5
    public function __construct($mappings)
18
    {
19 5
        foreach ($mappings as $mapping) {
20 5
            $this->addMapping($mapping);
21 5
        }
22 5
    }
23
24 5
    public function getMappings()
25
    {
26 5
        return $this->mappings;
27
    }
28
29
    /**
30
     * @param MappingInterface $mapping
31
     */
32 5
    private function addMapping(MappingInterface $mapping)
33
    {
34 5
        $this->mappings[] = $mapping;
35 5
    }
36
}
37