Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2.1481 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | 1 | public function __invoke(string $json): FindSiteResponse |
|
33 | { |
||
34 | /** @var array $array */ |
||
35 | 1 | $array = json_decode($json, true); |
|
|
|||
36 | |||
37 | 1 | if (json_last_error() !== JSON_ERROR_NONE) { |
|
38 | 1 | throw new InvalidArgumentException('Invalid or malformed JSON'); |
|
39 | } |
||
40 | |||
41 | $serializer = (new SerializerFactory())(); |
||
42 | |||
43 | /** @var FindSiteResponse $response */ |
||
44 | return $serializer->deserialize($json, FindSiteResponse::class, 'json'); |
||
45 | } |
||
47 |