vendor/boldr/shop-bundle/src/Link/ShopLinks.php line 23

Open in your IDE?
  1. <?php
  2. namespace Boldr\Shop\ShopBundle\Link;
  3. use Boldr\Cms\CmsBundle\Link\{ LinkProviderInterfaceLinkGeneratorInterfaceLinkInterface };
  4. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  5. class ShopLinks implements LinkProviderInterfaceLinkGeneratorInterface
  6. {
  7.     private const ROUTES = [
  8.         'shop' => 'shop_shop',
  9.     ];
  10.     private UrlGeneratorInterface $urlGenerator;
  11.     public function __construct(UrlGeneratorInterface $urlGenerator)
  12.     {
  13.         $this->urlGenerator $urlGenerator;
  14.     }
  15.     public function getName(): string { return 'Shop'; }
  16.     public function getLinks(?string $search nullint $amount): iterable
  17.     {
  18.         yield new ShopLink('shop');
  19.     }
  20.     /**
  21.      * @param ShopLink $link
  22.      */
  23.     public function generateLinkUrl(LinkInterface $link): string
  24.     {
  25.         return $this->urlGenerator->generate(self::ROUTES[$link->getLink()]);
  26.     }
  27. }