vendor/payum/payum-bundle/EventListener/ReplyToHttpResponseListener.php line 26

Open in your IDE?
  1. <?php
  2. namespace Payum\Bundle\PayumBundle\EventListener;
  3. use Payum\Core\Bridge\Symfony\ReplyToSymfonyResponseConverter;
  4. use Payum\Core\Reply\ReplyInterface;
  5. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  6. class ReplyToHttpResponseListener
  7. {
  8.     /**
  9.      * @var ReplyToSymfonyResponseConverter
  10.      */
  11.     private $replyToSymfonyResponseConverter;
  12.     /**
  13.      * @param ReplyToSymfonyResponseConverter $replyToSymfonyResponseConverter
  14.      */
  15.     public function __construct(ReplyToSymfonyResponseConverter $replyToSymfonyResponseConverter)
  16.     {
  17.         $this->replyToSymfonyResponseConverter $replyToSymfonyResponseConverter;
  18.     }
  19.     /**
  20.      * @param ExceptionEvent $event
  21.      */
  22.     public function onKernelException(ExceptionEvent $event)
  23.     {
  24.         if (false === $event->getThrowable() instanceof ReplyInterface) {
  25.             return;
  26.         }
  27.         $response $this->replyToSymfonyResponseConverter->convert($event->getThrowable());
  28.         $event->allowCustomResponseCode();
  29.         $event->setResponse($response);
  30.     }
  31. }