GetRegionByPhoneMapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 5
c 1
b 0
f 1
dl 0
loc 26
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A map() 0 4 1
1
<?php
2
3
namespace Phrlog\Zvonok\Phone\Mapper;
4
5
use Phrlog\Zvonok\Phone\Response\RegionResponse;
6
use Phrlog\Zvonok\Phone\Response\ResponseInterface;
7
8
/**
9
 * Class GetRegionByPhoneMapper
10
 */
11
class GetRegionByPhoneMapper implements ResponseInterface
12
{
13
    /**
14
     * @var \JsonMapper
15
     */
16
    protected $mapper;
17
18
    /**
19
     * GetRegionByPhoneMapper constructor.
20
     * @param \JsonMapper $mapper
21
     */
22
    public function __construct(\JsonMapper $mapper)
23
    {
24
        $this->mapper = $mapper;
25
    }
26
27
    /**
28
     * @param string $json
29
     *
30
     * @return RegionResponse
31
     * @throws \JsonMapper_Exception
32
     */
33
    public function map(string $json): RegionResponse
34
    {
35
        $json = json_decode($json);
36
        return $this->mapper->map($json, new RegionResponse());
37
    }
38
}
39