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