GetCallByPhoneMapper::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Phrlog\Zvonok\Phone\Mapper;
4
5
use Phrlog\Zvonok\Phone\Response\CallResultResponse;
6
use Phrlog\Zvonok\Phone\Response\ResponseInterface;
7
8
/**
9
 * Class GetCallByPhoneMapper
10
 */
11
class GetCallByPhoneMapper implements ResponseInterface
12
{
13
    /**
14
     * @var \JsonMapper
15
     */
16
    protected $mapper;
17
18
    /**
19
     * GetCallByPhoneMapper 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 CallResultResponse
31
     * @throws \JsonMapper_Exception
32
     */
33
    public function map(string $json): CallResultResponse
34
    {
35
        $json = json_decode($json);
36
37
        return $this->mapper->map($json, new CallResultResponse());
38
    }
39
}
40