vendor/crea/floa-bundle/src/EventSubscriber/FloaExceptionEventSubscriber.php line 34

Open in your IDE?
  1. <?php
  2. namespace Crea\FloaBundle\EventSubscriber;
  3. use Crea\FloaBundle\Event\FloaExceptionEvent;
  4. use Crea\FloaBundle\Exception\AbstractFloaException;
  5. use Crea\FloaBundle\FloaEvents;
  6. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  7. use Symfony\Component\HttpKernel\KernelInterface;
  8. use Throwable;
  9. class FloaExceptionEventSubscriber implements EventSubscriberInterface
  10. {
  11.     protected KernelInterface $kernel;
  12.     public function __construct(KernelInterface $kernel)
  13.     {
  14.         $this->kernel $kernel;
  15.     }
  16.     public static function getSubscribedEvents(): array
  17.     {
  18.         return [
  19.             FloaEvents::MISSING_ADAPTER_EXCEPTION => [['handleException'256]],
  20.             FloaEvents::MISSING_ELIGIBILITY_EXCEPTION => [['handleException'256]],
  21.             FloaEvents::CLIENT_TOKEN_EXCEPTION => [['handleException'256]],
  22.             FloaEvents::CLIENT_PRE_ELIGIBILITY_EXCEPTION => [['handleException'256]],
  23.             FloaEvents::CLIENT_ELIGIBILITY_EXCEPTION => [['handleException'256]],
  24.             FloaEvents::CLIENT_PAYMENT_SESSION_EXCEPTION => [['handleException'256]],
  25.         ];
  26.     }
  27.     public function handleException(FloaExceptionEvent $event)
  28.     {
  29.         if ($this->supportException($exception $event->getException())) {
  30.             if ($this->kernel->getEnvironment() === "dev") {
  31.                 dump($exception);
  32.             }
  33.         }
  34.     }
  35.     private function supportException(Throwable $exception): bool
  36.     {
  37.         return $exception instanceof AbstractFloaException;
  38.     }
  39. }