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