vendor/nellapp/sdk-bundle/src/EventSubscriber/RequestChannelDomainSubscriber.php line 27

Open in your IDE?
  1. <?php
  2. namespace Nellapp\Bundle\SDKBundle\EventSubscriber;
  3. use Nellapp\Bundle\SDKBundle\Routing\Utils\ChannelMainDomainUtils;
  4. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  5. use Symfony\Component\HttpKernel\Event\KernelEvent;
  6. use Symfony\Component\HttpKernel\KernelEvents;
  7. use Symfony\Component\Routing\RouterInterface;
  8. class RequestChannelDomainSubscriber implements EventSubscriberInterface
  9. {
  10. public function __construct(
  11. private ChannelMainDomainUtils $channelMainDomainUtils,
  12. private RouterInterface $router,
  13. )
  14. {
  15. }
  16. public static function getSubscribedEvents(): array
  17. {
  18. return [
  19. KernelEvents::REQUEST => ['__invoke', 32], // keep high priority
  20. ];
  21. }
  22. public function __invoke(KernelEvent $event): void
  23. {
  24. $baseDomain = $this->channelMainDomainUtils->getChannelDomainFromRequest();
  25. $this->channelMainDomainUtils->applyChannelDomainToContext($this->router, $baseDomain);
  26. }
  27. }