/** * Read configuration scope * * @return array * * @throws \Magento\Framework\Exception\LocalizedException */ public function read() { $fileList = []; foreach ($this->_scopePriorityScheme as $scope) { $directories = $this->_fileResolver->get($this->_fileName, $scope); foreach ($directories as $key => $directory) { $fileList[$key] = $directory; } } if (!count($fileList)) { return []; } /** @var \Magento\Framework\Config\Dom $domDocument */ $domDocument = null; foreach ($fileList as $file) { try { if ($domDocument === null) { $class = $this->_domDocumentClass; $domDocument = new $class($file, [], null, $this->_schemaFile); } else { $domDocument->merge($file); } } catch (\Magento\Framework\Config\Dom\ValidationException $e) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase("Invalid XML in file %1:\n%2", [$file, $e->getMessage()])); } } $output = []; if ($domDocument) { $output = $this->_converter->convert($domDocument->getDom()); } return $output; }
/** * Load configuration scope * * @param string|null $scope * @return array */ public function read($scope = null) { $scope = $scope ?: $this->_defaultScope; $fileList = $this->_fileResolver->get($this->_fileName, $scope); if (!count($fileList)) { return []; } $output = $this->_readFiles($fileList); return $output; }