src/EventSubscriber/SiteSubscriber.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\EventSubscriber;
  3. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  4. use Symfony\Component\HttpKernel\Event\RequestEvent;
  5. use Symfony\Component\HttpKernel\KernelEvents;
  6. class SiteSubscriber implements EventSubscriberInterface
  7. {
  8.     public function onKernelRequest(RequestEvent $event)
  9.     {
  10.         $request $event->getRequest();
  11.         // TODO some logic to determine the $locale
  12. //        $request->setLocale('pirate');
  13.     }
  14.     /**
  15.      * {@inheritDoc}
  16.      * @codeCoverageIgnore
  17.      */
  18.     public static function getSubscribedEvents(): array
  19.     {
  20.         return [
  21.             KernelEvents::REQUEST => [
  22.                 ['onKernelRequest'110]
  23.             ],
  24.         ];
  25.     }
  26. }