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

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.     public function __construct(SystemConfigService $configAbstractTranslator $translatorCacheTagCollection $collection)
  15.     {
  16.         $this->config $config;
  17.         $this->translator $translator;
  18.         $this->collection $collection;
  19.     }
  20.     public function getDecorated(): AbstractCacheTracer
  21.     {
  22.         throw new DecorationPatternException(self::class);
  23.     }
  24.     /**
  25.      * @return mixed|null All kind of data could be cached
  26.      */
  27.     public function trace(string $key\Closure $param)
  28.     {
  29.         return $this->collection->trace($key, function () use ($key$param) {
  30.             return $this->translator->trace($key, function () use ($key$param) {
  31.                 return $this->config->trace($key$param);
  32.             });
  33.         });
  34.     }
  35.     public function get(string $key): array
  36.     {
  37.         return array_merge(
  38.             $this->collection->getTrace($key),
  39.             $this->config->getTrace($key),
  40.             $this->translator->getTrace($key)
  41.         );
  42.     }
  43. }