vendor/shopware/core/Content/Seo/EmptyPathInfoResolver.php line 35

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Content\Seo;
  3. use Shopware\Core\Framework\Log\Package;
  4. /**
  5.  * @phpstan-import-type ResolvedSeoUrl from AbstractSeoResolver
  6.  */
  7. #[Package('sales-channel')]
  8. class EmptyPathInfoResolver extends AbstractSeoResolver
  9. {
  10.     /**
  11.      * @internal
  12.      */
  13.     public function __construct(private readonly AbstractSeoResolver $decorated)
  14.     {
  15.     }
  16.     public function getDecorated(): AbstractSeoResolver
  17.     {
  18.         return $this->decorated;
  19.     }
  20.     /**
  21.      * @return ResolvedSeoUrl
  22.      */
  23.     public function resolve(string $languageIdstring $salesChannelIdstring $pathInfo): array
  24.     {
  25.         $seoPathInfo ltrim($pathInfo'/');
  26.         if ($seoPathInfo === '') {
  27.             return ['pathInfo' => '/''isCanonical' => false];
  28.         }
  29.         return $this->getDecorated()->resolve($languageId$salesChannelId$pathInfo);
  30.     }
  31. }