Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
28 | public function __invoke(string $json): DestinationServicesResponse |
||
29 | { |
||
30 | json_decode($json, true); |
||
31 | |||
32 | if (json_last_error() !== JSON_ERROR_NONE) { |
||
33 | throw new InvalidArgumentException('Invalid or malformed JSON'); |
||
34 | } |
||
35 | |||
36 | $serializer = (new SerializerFactory())(); |
||
37 | |||
38 | /** @var DestinationServicesResponse $response */ |
||
39 | $response = $serializer->deserialize($json, DestinationServicesResponse::class, 'json'); |
||
40 | |||
41 | return $response; |
||
42 | } |
||
44 |