| Conditions | 3 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 117 | protected function decodeResponse(ResponseInterface $response): stdClass |
|
| 19 | { |
||
| 20 | 117 | $contentType = null; |
|
| 21 | 117 | $rawContentType = $response->getHeader('Content-type'); |
|
| 22 | 117 | if (is_array($rawContentType) && sizeOf($rawContentType) > 0) { |
|
| 23 | 117 | $contentType = $rawContentType[0]; |
|
| 24 | } |
||
| 25 | |||
| 26 | 117 | return match ($contentType) { |
|
| 27 | 117 | "application/json; charset=utf-8" => $this->decodeJsonResponse($response), |
|
| 28 | 117 | "text/plain; charset=utf-8" => $this->decodeTextResponse($response), |
|
| 29 | 117 | default => (object) $response->getBody()->getContents(), |
|
| 30 | 117 | }; |
|
| 42 |