vendor/shopware/core/System/SystemConfig/MemoizedSystemConfigLoader.php line 31

  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\SystemConfig;
  3. use Shopware\Core\Framework\Log\Package;
  4. use Shopware\Core\System\SystemConfig\Store\MemoizedSystemConfigStore;
  5. #[Package('system-settings')]
  6. class MemoizedSystemConfigLoader extends AbstractSystemConfigLoader
  7. {
  8.     /**
  9.      * @internal
  10.      */
  11.     public function __construct(private readonly AbstractSystemConfigLoader $decorated, private readonly MemoizedSystemConfigStore $memoizedSystemConfigStore)
  12.     {
  13.     }
  14.     public function getDecorated(): AbstractSystemConfigLoader
  15.     {
  16.         return $this->decorated;
  17.     }
  18.     public function load(?string $salesChannelId): array
  19.     {
  20.         $config $this->memoizedSystemConfigStore->getConfig($salesChannelId);
  21.         if ($config !== null) {
  22.             return $config;
  23.         }
  24.         $config $this->getDecorated()->load($salesChannelId);
  25.         $this->memoizedSystemConfigStore->setConfig($salesChannelId$config);
  26.         return $config;
  27.     }
  28. }