vendor/sylius/sylius/src/Sylius/Bundle/CoreBundle/EventListener/LocaleAwareListener.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Sylius package.
  4.  *
  5.  * (c) Paweł Jędrzejewski
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\CoreBundle\EventListener;
  12. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  13. use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
  14. use Symfony\Component\HttpKernel\Event\RequestEvent;
  15. use Symfony\Component\HttpKernel\EventListener\LocaleAwareListener as DecoratedLocaleListener;
  16. use Symfony\Component\HttpKernel\KernelEvents;
  17. class LocaleAwareListener implements EventSubscriberInterface
  18. {
  19.     public function __construct(private DecoratedLocaleListener $decoratedListener)
  20.     {
  21.     }
  22.     public function onKernelRequest(RequestEvent $event): void
  23.     {
  24.         $this->decoratedListener->onKernelRequest($event);
  25.     }
  26.     public function onKernelFinishRequest(FinishRequestEvent $event): void
  27.     {
  28.         $this->decoratedListener->onKernelFinishRequest($event);
  29.     }
  30.     public static function getSubscribedEvents(): array
  31.     {
  32.         return [
  33.             // must be registered after the Locale listener
  34.             KernelEvents::REQUEST => [['onKernelRequest'4]],
  35.             KernelEvents::FINISH_REQUEST => [['onKernelFinishRequest', -15]],
  36.         ];
  37.     }
  38. }