| Conditions | 6 |
| Paths | 8 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | private function buildSections($exception) |
||
| 34 | { |
||
| 35 | $sections = []; |
||
| 36 | |||
| 37 | if ($exception instanceof \Exception) { |
||
| 38 | $formatter = new ExceptionFormatter(); |
||
| 39 | $sections['Exception'] = $formatter->format($exception); |
||
| 40 | } |
||
| 41 | |||
| 42 | if (method_exists($exception, 'getRequest') && $exception->getRequest() instanceof RequestInterface) { |
||
| 43 | $formatter = new RequestFormatter(); |
||
| 44 | $sections['Request'] = $formatter->format($exception->getRequest()); |
||
| 45 | } |
||
| 46 | |||
| 47 | if (method_exists($exception, 'getResponse') && $exception->getResponse() instanceof ResponseInterface) { |
||
| 48 | $formatter = new ResponseFormatter(); |
||
| 49 | $sections['Response'] = $formatter->format($exception->getResponse()); |
||
| 50 | } |
||
| 51 | |||
| 52 | return $sections; |
||
| 53 | } |
||
| 54 | } |
||
| 55 |