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

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