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