Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConsolidatedConfig.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
17  const CACHE_ID = 'integration-consolidated';
18 
22  protected $configCacheType;
23 
27  protected $configReader;
28 
34  protected $integrations;
35 
39  private $serializer;
40 
46  public function __construct(
48  Config\Consolidated\Reader $configReader,
49  SerializerInterface $serializer = null
50  ) {
51  $this->configCacheType = $configCacheType;
52  $this->configReader = $configReader;
53  $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
54  }
55 
61  public function getIntegrations()
62  {
63  if (null === $this->integrations) {
64  $integrations = $this->configCacheType->load(self::CACHE_ID);
65  if ($integrations && is_string($integrations)) {
66  $this->integrations = $this->serializer->unserialize($integrations);
67  } else {
68  $this->integrations = $this->configReader->read();
69  $this->configCacheType->save(
70  $this->serializer->serialize($this->integrations),
73  );
74  }
75  }
76  return $this->integrations;
77  }
78 }
__construct(Cache\TypeConsolidated $configCacheType, Config\Consolidated\Reader $configReader, SerializerInterface $serializer=null)