serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance() ->get(SerializerInterface::class); $data = $cache->load(self::CACHE_ID); if (!$data) { $data = $reader->read(); $cache->save($this->serializer->serialize($data), self::CACHE_ID); } else { $data = $this->serializer->unserialize($data); } $this->_data = $data['data']; $this->_metadata = $data['metadata']; } /** * Get initial data by given scope * * @param string $scope Format is scope type and scope code separated by pipe: e.g. "type|code" * @return array */ public function getData($scope) { list($scopeType, $scopeCode) = array_pad(explode('|', $scope), 2, null); if (ScopeConfigInterface::SCOPE_TYPE_DEFAULT == $scopeType) { return $this->_data[$scopeType] ?? []; } elseif ($scopeCode) { return $this->_data[$scopeType][$scopeCode] ?? []; } return []; } /** * Get configuration metadata * * @return array */ public function getMetadata() { return $this->_metadata; } }