vendor/nellapp/sdk-bundle/src/Routing/SymfonyUrlGenerator.php line 24

Open in your IDE?
  1. <?php
  2. namespace Nellapp\Bundle\SDKBundle\Routing;
  3. use Nellapp\Bundle\SDKBundle\Routing\ChannelMainDomain\ChannelMainDomainInterface;
  4. use Nellapp\Bundle\SDKBundle\Routing\ChannelMainDomain\ChannelMainDomainTrait;
  5. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  6. use Symfony\Component\Routing\RouterInterface;
  7. use Symfony\Component\Routing\RequestContext;
  8. use Symfony\Component\Routing\RouteCollection;
  9. use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
  10. class SymfonyUrlGenerator implements RouterInterface, WarmableInterface, ChannelMainDomainInterface
  11. {
  12. use ChannelMainDomainTrait;
  13. public function __construct(
  14. private RouterInterface $inner,
  15. private RequestContext $context,
  16. )
  17. {
  18. }
  19. public function generate($name, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
  20. {
  21. $route = $this->inner->getRouteCollection()->get($name);
  22. $this->applyChannelDomain($route, $this->context, $parameters);
  23. return $this->inner->generate($name, $parameters, $referenceType);
  24. }
  25. public function setContext(RequestContext $context)
  26. {
  27. $this->inner->setContext($context);
  28. $this->context = $context;
  29. }
  30. public function getContext(): RequestContext
  31. {
  32. return $this->context;
  33. }
  34. public function getRouteCollection(): RouteCollection
  35. {
  36. return $this->inner->getRouteCollection();
  37. }
  38. public function match($pathinfo): array
  39. {
  40. return $this->inner->match($pathinfo);
  41. }
  42. public function warmUp(string $cacheDir): array
  43. {
  44. return $this->inner->warmUp($cacheDir);
  45. }
  46. }