Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Reader.php
Go to the documentation of this file.
1 <?php
7 
14 
18 class Reader extends Filesystem
19 {
25  protected $_idAttributes = [
26  '/rules/payment' => 'id',
27  '/rules/payment(/relation)+' => 'target'
28  ];
29 
43  public function __construct(
44  FileResolverInterface $fileResolver,
45  Converter $converter,
46  SchemaLocatorInterface $schemaLocator,
49  $fileName = 'adminhtml/rules/payment_{country}.xml',
50  $idAttributes = [],
51  $domDocumentClass = \Magento\Framework\Config\Dom::class,
52  $defaultScope = 'primary'
53  ) {
54  $fileName = str_replace('{country}', strtolower($helper->getConfigurationCountryCode()), $fileName);
55  parent::__construct(
56  $fileResolver,
57  $converter,
58  $schemaLocator,
60  $fileName,
61  $idAttributes,
62  $domDocumentClass,
63  $defaultScope
64  );
65  }
66 
73  public function read($scope = null)
74  {
75  $scope = $scope ?: $this->_defaultScope;
76  $fileList = $this->_fileResolver->get($this->_fileName, $scope);
77 
78  if (!count($fileList)) {
79  return $this->_readFiles($this->_fileResolver->get('adminhtml/rules/payment_other.xml', $scope));
80  }
81 
82  return $this->_readFiles($fileList);
83  }
84 }
$helper
Definition: iframe.phtml:13
$fileList
Definition: export.php:13
$fileName
Definition: translate.phtml:15
__construct(FileResolverInterface $fileResolver, Converter $converter, SchemaLocatorInterface $schemaLocator, ValidationStateInterface $validationState, Backend $helper, $fileName='adminhtml/rules/payment_{country}.xml', $idAttributes=[], $domDocumentClass=\Magento\Framework\Config\Dom::class, $defaultScope='primary')
Definition: Reader.php:43