Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
FileResolver.php
Go to the documentation of this file.
1 <?php
9 
12 
14 {
20  protected $_moduleReader;
21 
25  protected $iteratorFactory;
26 
30  private $componentDirSearch;
31 
37  public function __construct(
38  \Magento\Framework\Module\Dir\Reader $moduleReader,
39  \Magento\Framework\Config\FileIteratorFactory $iteratorFactory,
40  DirSearch $componentDirSearch
41  ) {
42  $this->iteratorFactory = $iteratorFactory;
43  $this->_moduleReader = $moduleReader;
44  $this->componentDirSearch = $componentDirSearch;
45  }
46 
50  public function get($filename, $scope)
51  {
52  switch ($scope) {
53  case 'global':
54  $iterator = $this->_moduleReader->getConfigurationFiles($filename);
55  break;
56  case 'design':
57  $themePaths = $this->componentDirSearch->collectFiles(ComponentRegistrar::THEME, 'etc/' . $filename);
58  $iterator = $this->iteratorFactory->create($themePaths);
59  break;
60  default:
61  $iterator = $this->iteratorFactory->create([]);
62  break;
63  }
64  return $iterator;
65  }
66 }
__construct(\Magento\Framework\Module\Dir\Reader $moduleReader, \Magento\Framework\Config\FileIteratorFactory $iteratorFactory, DirSearch $componentDirSearch)