| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | function parse_metadata_response(ResponseInterface $response, ?int $expectedCode = null): array |
||
| 22 | { |
||
| 23 | 10 | check_server_response($response, $expectedCode); |
|
| 24 | |||
| 25 | /** @var bool|P $data */ |
||
| 26 | 8 | $data = json_decode((string) $response->getBody(), true); |
|
| 27 | |||
| 28 | 8 | if (! is_array($data)) { |
|
|
|
|||
| 29 | 1 | throw new InvalidArgumentException('Invalid metadata content'); |
|
| 30 | } |
||
| 31 | |||
| 32 | 7 | return $data; |
|
| 33 | } |
||
| 34 |