vendor/sylius/sylius/src/Sylius/Component/Channel/Context/RequestBased/HostnameBasedRequestResolver.php line 29

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\Component\Channel\Context\RequestBased;
  12. use Sylius\Component\Channel\Model\ChannelInterface;
  13. use Sylius\Component\Channel\Repository\ChannelRepositoryInterface;
  14. use Symfony\Component\HttpFoundation\Request;
  15. final class HostnameBasedRequestResolver implements RequestResolverInterface
  16. {
  17.     private ChannelRepositoryInterface $channelRepository;
  18.     public function __construct(ChannelRepositoryInterface $channelRepository)
  19.     {
  20.         $this->channelRepository $channelRepository;
  21.     }
  22.     public function findChannel(Request $request): ?ChannelInterface
  23.     {
  24.         return $this->channelRepository->findOneByHostname($request->getHost());
  25.     }
  26. }