| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 32 | public function getBody() |
||
| 33 | { |
||
| 34 | if (!is_callable([$this->response, 'getBody']) || |
||
| 35 | !is_callable([$this->response->getBody(), 'getContents'])) { |
||
| 36 | throw new \Exception('Could not retrieve response body'); |
||
| 37 | } |
||
| 38 | |||
| 39 | $body = json_decode($this->response->getBody()->getContents(), true); |
||
| 40 | |||
| 41 | if (empty($body)) { |
||
| 42 | throw new \Exception('Could not retrieve response body'); |
||
| 43 | } |
||
| 44 | |||
| 45 | return $body; |
||
| 46 | } |
||
| 47 | |||
| 63 | } |