src/EventSubscriber/QPostmasterEvents.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\HttpKernel\Event\ControllerEvent;
  6. use Symfony\Component\HttpKernel\Event\RequestEvent;
  7. use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  8. use Symfony\Component\HttpKernel\KernelEvents;
  9. class QPostmasterEvents implements EventSubscriberInterface
  10. {
  11.     public function onKernelController(ControllerEvent $event)
  12.     {
  13.         $controller $event->getController();
  14.         
  15.         /*
  16.          * $controller passed can be either a class or a Closure.
  17.          * This is not usual in Symfony but it may happen.
  18.          * If it is a class, it comes in array format
  19.          */
  20.         if (!is_array($controller)) {
  21.             return;
  22.         }
  23.         
  24.         if ($controller[0] instanceof AbstractController) {
  25.             // nothing
  26.         }
  27.     }
  28.     
  29.     public static function getSubscribedEvents()
  30.     {
  31.         return [
  32.             KernelEvents::CONTROLLER => 'onKernelController',
  33.         ];
  34.     }
  35.     
  36. }