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

ArrayMapper::map()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
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