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