Completed
Push — master ( 1e376d...b0060a )
by Changwan
05:50
created

ArrayMapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A map() 0 4 2
1
<?php
2
namespace Wandu\Support\Mapper;
3
4
use Wandu\Support\Contracts\MapperInterface;
5
6
class ArrayMapper implements MapperInterface 
7
{
8
    /** @var array|string[] */
9
    private $map;
10
11
    /**
12
     * @param array|string[] $map
13
     */
14
    public function __construct(array $map)
15
    {
16
        $this->map = $map;
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function map($name)
23
    {
24
        return isset($this->map[$name]) ? $this->map[$name] : $name;
25
    }
26
}
27