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

  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(
  18.         private readonly AbstractCacheTracer $decorated,
  19.         private readonly ThemeConfigValueAccessor $themeConfigAccessor
  20.     ) {
  21.     }
  22.     public function getDecorated(): AbstractCacheTracer
  23.     {
  24.         return $this->decorated;
  25.     }
  26.     public function trace(string $key\Closure $param)
  27.     {
  28.         return $this->themeConfigAccessor->trace($key, fn () => $this->getDecorated()->trace($key$param));
  29.     }
  30.     public function get(string $key): array
  31.     {
  32.         return array_unique(array_merge(
  33.             $this->themeConfigAccessor->getTrace($key),
  34.             $this->getDecorated()->get($key)
  35.         ));
  36.     }
  37. }