vendor/shopware/storefront/Framework/Cache/CacheTracer.php line 31

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Storefront\Framework\Cache;
  3. use Shopware\Core\Framework\Adapter\Cache\AbstractCacheTracer;
  4. use Shopware\Core\Framework\Log\Package;
  5. use Shopware\Storefront\Theme\ThemeConfigValueAccessor;
  6. /**
  7.  * @extends AbstractCacheTracer<mixed|null>
  8.  */
  9. #[Package('storefront')]
  10. class CacheTracer extends AbstractCacheTracer
  11. {
  12.     /**
  13.      * @internal
  14.      *
  15.      * @param AbstractCacheTracer<mixed|null> $decorated
  16.      */
  17.     public function __construct(private readonly AbstractCacheTracer $decorated, private readonly ThemeConfigValueAccessor $themeConfigAccessor)
  18.     {
  19.     }
  20.     public function getDecorated(): AbstractCacheTracer
  21.     {
  22.         return $this->decorated;
  23.     }
  24.     public function trace(string $key\Closure $param)
  25.     {
  26.         return $this->themeConfigAccessor->trace($key, fn () => $this->getDecorated()->trace($key$param));
  27.     }
  28.     public function get(string $key): array
  29.     {
  30.         return array_unique(array_merge(
  31.             $this->themeConfigAccessor->getTrace($key),
  32.             $this->getDecorated()->get($key)
  33.         ));
  34.     }
  35. }