| Conditions | 4 |
| Paths | 4 |
| Total Lines | 30 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 27 | public function onKernelException(GetResponseForExceptionEvent $event) |
||
| 28 | { |
||
| 29 | $exception = $event->getException(); |
||
| 30 | |||
| 31 | // check if exception is part of this bundle |
||
| 32 | if (!($exception instanceof Exception)) { |
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | |||
| 36 | $redirect = ''; |
||
| 37 | |||
| 38 | if ($exception instanceof PaymentException) { |
||
| 39 | $redirect = $exception->getPayment()->getReferrer(); |
||
| 40 | if (!$redirect) { |
||
| 41 | $redirect = 'http://'.$exception->getPayment()->getCallBackServerUrl(); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | |||
| 45 | $responseText = $this->engine->render('@LoevgaardDandomainAltapay/error/error.html.twig', [ |
||
| 46 | 'error' => $exception->getMessage(), |
||
| 47 | 'redirect' => $redirect, |
||
| 48 | ]); |
||
| 49 | |||
| 50 | $response = new Response(); |
||
| 51 | $response->setContent($responseText); |
||
| 52 | |||
| 53 | $event->setResponse($response); |
||
| 54 | |||
| 55 | return true; |
||
| 56 | } |
||
| 57 | } |
||
| 58 |