vendor/shopware/core/Framework/Adapter/Cache/CacheTracer.php line 44

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Adapter\Cache;
  3. use Shopware\Core\Framework\Adapter\Translation\AbstractTranslator;
  4. use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
  5. use Shopware\Core\System\SystemConfig\SystemConfigService;
  6. /**
  7.  * @extends AbstractCacheTracer<mixed|null>
  8.  */
  9. class CacheTracer extends AbstractCacheTracer
  10. {
  11.     private SystemConfigService $config;
  12.     private AbstractTranslator $translator;
  13.     private CacheTagCollection $collection;
  14.     /**
  15.      * @internal
  16.      */
  17.     public function __construct(SystemConfigService $configAbstractTranslator $translatorCacheTagCollection $collection)
  18.     {
  19.         $this->config $config;
  20.         $this->translator $translator;
  21.         $this->collection $collection;
  22.     }
  23.     public function getDecorated(): AbstractCacheTracer
  24.     {
  25.         throw new DecorationPatternException(self::class);
  26.     }
  27.     /**
  28.      * @return mixed|null All kind of data could be cached
  29.      */
  30.     public function trace(string $key\Closure $param)
  31.     {
  32.         return $this->collection->trace($key, function () use ($key$param) {
  33.             return $this->translator->trace($key, function () use ($key$param) {
  34.                 return $this->config->trace($key$param);
  35.             });
  36.         });
  37.     }
  38.     public function get(string $key): array
  39.     {
  40.         return array_merge(
  41.             $this->collection->getTrace($key),
  42.             $this->config->getTrace($key),
  43.             $this->translator->getTrace($key)
  44.         );
  45.     }
  46. }