Conditions | 4 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 14 |
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 | $redirect = ''; |
||
34 | |||
35 | if ($exception instanceof PaymentException) { |
||
36 | $redirect = $exception->getPayment()->getReferrer(); |
||
37 | if (!$redirect) { |
||
38 | $redirect = 'http://'.$exception->getPayment()->getCallBackServerUrl(); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | $responseText = $this->engine->render('@LoevgaardDandomainAltapay/error/error.html.twig', [ |
||
43 | 'error' => $exception->getMessage(), |
||
44 | 'redirect' => $redirect, |
||
45 | ]); |
||
46 | |||
47 | $response = new Response(); |
||
48 | $response->setContent($responseText); |
||
49 | |||
50 | $event->setResponse($response); |
||
51 | } |
||
52 | } |
||
53 | } |
||
54 |