| Conditions | 3 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 12 | private function getNormalizedResponse(string $body) |
|
| 19 | { |
||
| 20 | 12 | $decodedResponse = $this->getJsonDecodedResponse($body); |
|
| 21 | |||
| 22 | 10 | if (false === array_key_exists('data', $decodedResponse) && empty($decodedResponse['errors'])) { |
|
| 23 | 4 | throw new \UnexpectedValueException( |
|
| 24 | 4 | 'Invalid GraphQL JSON response. Response body: ' . json_encode($decodedResponse) |
|
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | return [ |
||
| 29 | 6 | 'data' => $decodedResponse['data'] ?? [], |
|
| 30 | 6 | 'errors' => $decodedResponse['errors'] ?? [], |
|
| 31 | ]; |
||
| 32 | } |
||
| 33 | |||
| 48 |