| Conditions | 3 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 4 | ||
| Bugs | 2 | Features | 2 |
| 1 | <?php |
||
| 33 | public function handle($request, Closure $next) |
||
| 34 | { |
||
| 35 | $response = $next($request); |
||
| 36 | |||
| 37 | // Was an OAuthException previously caught by the pipeline? If so, hijack response, replacing with json error. |
||
|
|
|||
| 38 | if (isset($response->exception) && $response->exception instanceof OAuthException) { |
||
| 39 | |||
| 40 | $data = [ |
||
| 41 | 'error' => $response->exception->errorType, |
||
| 42 | 'error_description' => $response->exception->getMessage(), |
||
| 43 | ]; |
||
| 44 | |||
| 45 | return new JsonResponse($data, $response->exception->httpStatusCode, $response->exception->getHttpHeaders()); |
||
| 46 | } |
||
| 47 | |||
| 48 | return $response; |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.