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