| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 11 | public function parseJson(): array |
|
| 34 | { |
||
| 35 | 11 | $response = $this->toString(); |
|
| 36 | 11 | $data = json_decode($response, true); |
|
| 37 | |||
| 38 | 11 | if (! $data) { |
|
| 39 | 2 | throw new ImpossibleToParseJsonException( |
|
| 40 | 'Service response could not be parsed to JSON, Response: ' . |
||
| 41 | 2 | $response . ', Reason: ' . json_last_error() |
|
| 42 | ); |
||
| 43 | } |
||
| 44 | |||
| 45 | 9 | return $data; |
|
| 46 | } |
||
| 56 |