vendor/babdev/pagerfanta-bundle/src/EventListener/ConvertNotValidCurrentPageToNotFoundListener.php line 11

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace BabDev\PagerfantaBundle\EventListener;
  3. use Pagerfanta\Exception\NotValidCurrentPageException;
  4. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  5. use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
  6. final class ConvertNotValidCurrentPageToNotFoundListener
  7. {
  8.     public function onKernelException(ExceptionEvent $event): void
  9.     {
  10.         $throwable $event->getThrowable();
  11.         if ($throwable instanceof NotValidCurrentPageException) {
  12.             $event->setThrowable(new NotFoundHttpException('Page Not Found'$throwable));
  13.         }
  14.     }
  15. }