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

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.      * @internal
  17.      *
  18.      * @param AbstractCacheTracer<mixed|null> $decorated
  19.      */
  20.     public function __construct(AbstractCacheTracer $decoratedThemeConfigValueAccessor $themeConfigAccessor)
  21.     {
  22.         $this->decorated $decorated;
  23.         $this->themeConfigAccessor $themeConfigAccessor;
  24.     }
  25.     public function getDecorated(): AbstractCacheTracer
  26.     {
  27.         return $this->decorated;
  28.     }
  29.     public function trace(string $key\Closure $param)
  30.     {
  31.         return $this->themeConfigAccessor->trace($key, function () use ($key$param) {
  32.             return $this->getDecorated()->trace($key$param);
  33.         });
  34.     }
  35.     public function get(string $key): array
  36.     {
  37.         return array_unique(array_merge(
  38.             $this->themeConfigAccessor->getTrace($key),
  39.             $this->getDecorated()->get($key)
  40.         ));
  41.     }
  42. }