| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | * @template P as array{error?: string, error_description?: string, error_uri?: string, response?: string}&array<string, mixed> |
||
| 19 | * @psalm-return array<string, mixed> |
||
| 20 | */ |
||
| 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 | |||
| 34 |