LocationMapper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 6 1
1
<?php
2
3
namespace Jne\Mappers\ArrayMappers;
4
5
use Jne\Location;
6
use Jne\Contracts\MapperInterface;
7
8
class LocationMapper implements MapperInterface
9
{
10
    /**
11
     * Map array data to instance of object.
12
     *
13
     * @param array $data
14
     *
15
     * @return mixed
16
     */
17
    public function map(array $data)
18
    {
19 4
        return array_map(function ($location) {
20 4
            return new Location($location['label'], $location['code']);
21 4
        }, $data);
22
    }
23
}
24