AddCallMapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A map() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace Phrlog\Zvonok\Phone\Mapper;
4
5
use Phrlog\Zvonok\Phone\Response\AddCallResponse;
6
use Phrlog\Zvonok\Phone\Response\ResponseInterface;
7
8
/**
9
 * Class CallAddMapper
10
 */
11
class AddCallMapper implements ResponseInterface
12
{
13
    /**
14
     * @var \JsonMapper
15
     */
16
    protected $mapper;
17
18
    /**
19
     * CallByIdMapper 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 AddCallResponse
31
     * @throws \JsonMapper_Exception
32
     */
33
    public function map(string $json): AddCallResponse
34
    {
35
        $json = json_decode($json);
36
37
        return $this->mapper->map($json, new AddCallResponse());
38
    }
39
}
40