Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FileResolverStub.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Ui\Config;
8 
13 
15 {
19  private $files = [
20  'etc/definition.xml' => [
21  'module_one/ui_component/etc/test_definition.xml',
22  'module_two/ui_component/etc/test_definition.xml'
23  ],
24  'etc/definition.map.xml' => [
25  'ui_component/etc/definition.map.xml'
26  ],
27  'etc/test_definition.xml' => [
28  'module_one/ui_component/etc/test_definition.xml',
29  'module_two/ui_component/etc/test_definition.xml'
30  ],
31  'test_component.xml' => [
32  'module_one/ui_component/test_component.xml',
33  'module_two/ui_component/test_component.xml'
34  ],
35  'parent_component.xml' => [
36  'module_one/ui_component/parent_component.xml',
37  'module_two/ui_component/parent_component.xml'
38  ]
39  ];
40 
44  private $moduleReader;
45 
52  public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader, array $files = [])
53  {
54  $this->files = array_replace($this->files, $files);
55  $this->moduleReader = $moduleReader;
56  }
57 
61  public function get($filename, $scope)
62  {
63  if ($filename == 'etc/definition.map.xml') {
64  $path = $this->moduleReader->getModuleDir(Dir::MODULE_VIEW_DIR, 'Magento_Ui') . '/base';
65  } else {
66  $path = realpath(__DIR__ . '/../_files/view');
67  }
68  $files = isset($this->files[$filename]) ? $this->files[$filename] : [];
69  $realPaths = [];
70  foreach ($files as $filePath) {
71  $realPaths[] = $path . '/' . $filePath;
72  }
73  return new FileIterator(new ReadFactory(new DriverPool), $realPaths);
74  }
75 }
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
__construct(\Magento\Framework\Module\Dir\Reader $moduleReader, array $files=[])