| Conditions | 3 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 42 | protected function apiError( |
||
| 43 | ResponseInterface $response, |
||
| 44 | string $message, |
||
| 45 | int $code = null |
||
| 46 | ): ResponseInterface { |
||
| 47 | if (is_null($code) || 0 == $code) { |
||
| 48 | $code = 400; |
||
| 49 | } |
||
| 50 | $data = ['message' => $message]; |
||
| 51 | return $this->renderJson( |
||
| 52 | $response, |
||
| 53 | 'error', |
||
| 54 | $data |
||
| 55 | )->withStatus($code); |
||
| 56 | } |
||
| 79 |