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

  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\Log\Package;
  5. use Shopware\Core\Framework\Plugin\Exception\DecorationPatternException;
  6. use Shopware\Core\System\SystemConfig\SystemConfigService;
  7. /**
  8.  * @extends AbstractCacheTracer<mixed|null>
  9.  */
  10. #[Package('core')]
  11. class CacheTracer extends AbstractCacheTracer
  12. {
  13.     /**
  14.      * @internal
  15.      */
  16.     public function __construct(
  17.         private readonly SystemConfigService $config,
  18.         private readonly AbstractTranslator $translator,
  19.         private readonly CacheTagCollection $collection
  20.     ) {
  21.     }
  22.     public function getDecorated(): AbstractCacheTracer
  23.     {
  24.         throw new DecorationPatternException(self::class);
  25.     }
  26.     public function trace(string $key\Closure $param)
  27.     {
  28.         return $this->collection->trace($key, fn () => $this->translator->trace($key, fn () => $this->config->trace($key$param)));
  29.     }
  30.     public function get(string $key): array
  31.     {
  32.         return array_merge(
  33.             $this->collection->getTrace($key),
  34.             $this->config->getTrace($key),
  35.             $this->translator->getTrace($key)
  36.         );
  37.     }
  38. }