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