Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
10 | public function __invoke(string $json): GetOfficesResponse |
||
11 | { |
||
12 | /** @var array $array */ |
||
13 | $array = json_decode($json, true); |
||
|
|||
14 | |||
15 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
16 | throw new InvalidArgumentException('Invalid or malformed JSON'); |
||
17 | } |
||
18 | |||
19 | $serializer = (new SerializerFactory())(); |
||
20 | |||
21 | /** @var GetOfficesResponse $response */ |
||
22 | return $serializer->deserialize($json, GetOfficesResponse::class, 'json'); |
||
23 | } |
||
25 |