StationMapper   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 3
c 3
b 0
f 0
lcom 0
cbo 1
dl 0
loc 23
ccs 9
cts 9
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 13 3
1
<?php
2
3
namespace Sl\Mappers;
4
5
use Sl\Station;
6
use Sl\Contracts\MapperInterface;
7
8
class StationMapper implements MapperInterface
9
{
10
    /**
11
     * Map data to array of object instance.
12
     *
13
     * @param array $data
14
     *
15
     * @return array
16
     */
17 2
    public function map(array $data)
18
    {
19 2
        $data = $data['data'];
20 2
        $stations = [];
21
22 2
        foreach ($data as $place) {
23 2
            if ($place['Type'] === 'station') {
24 2
                $stations[] = new Station($place['SiteId'], $place['Name']);
25 2
            }
26 2
        }
27
28 2
        return $stations;
29
    }
30
}
31