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

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