-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathAbstractReader.php
54 lines (50 loc) · 1.92 KB
/
AbstractReader.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @copyright: Copyright © 2017 Firebear Studio. All rights reserved.
* @author : Firebear Studio <[email protected]>
*/
namespace Firebear\ImportExport\Model;
use Magento\Framework\Config\FileResolverInterface;
use Magento\Framework\Config\Reader\Filesystem;
use Magento\Framework\Config\ValidationStateInterface;
class AbstractReader extends Filesystem
{
/**
* @var array
*/
protected $_idAttributes = [
'/config/type' => 'name'
];
/**
* AbstractReader constructor.
* @param FileResolverInterface $fileResolver
* @param ValidationStateInterface $validationState
* @param array $idAttributes
* @param string $domDocumentClass
* @param string $defaultScope
* @param string $fileName
* @param \Magento\Framework\Config\ConverterInterface|null $converter
* @param \Magento\Framework\Config\SchemaLocatorInterface|null $schemaLocator
*/
public function __construct(
FileResolverInterface $fileResolver,
ValidationStateInterface $validationState,
$idAttributes = [],
$domDocumentClass = 'Magento\Framework\Config\Dom',
$defaultScope = 'global',
$fileName = '',
\Magento\Framework\Config\ConverterInterface $converter = null,
\Magento\Framework\Config\SchemaLocatorInterface $schemaLocator = null
) {
$this->_fileResolver = $fileResolver;
$this->_converter = $converter;
$this->_fileName = $fileName;
$this->_idAttributes = array_replace($this->_idAttributes, $idAttributes);
$this->_schemaFile = $schemaLocator->getSchema();
$this->validationState = $validationState;
$this->_perFileSchema = $schemaLocator->getPerFileSchema() && $validationState->isValidationRequired()
? $schemaLocator->getPerFileSchema() : null;
$this->_domDocumentClass = $domDocumentClass;
$this->_defaultScope = $defaultScope;
}
}