| Conditions | 4 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 33 | 21 | protected function determineResponse($response) |
|
| 34 | { |
||
| 35 | 21 | if ($response instanceof ResponseInterface) { |
|
| 36 | 12 | return $response; |
|
| 37 | } |
||
| 38 | |||
| 39 | try { |
||
| 40 | 9 | $body = $response; |
|
| 41 | 9 | $response = $this->getResponse(); |
|
| 42 | |||
| 43 | 9 | if ($response->getBody()->isWritable()) { |
|
| 44 | 9 | $response->getBody()->write($body); |
|
| 45 | 6 | } |
|
| 46 | 9 | } catch (Exception $e) { |
|
| 47 | 3 | throw new RuntimeException('Unable to build a response object from controller return value', 0, $e); |
|
| 48 | } |
||
| 49 | |||
| 50 | 6 | return $response; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |