1212use Symfony \Component \Console \Input \InputOption ;
1313use Symfony \Component \Console \Input \InputInterface ;
1414use Symfony \Component \Console \Output \OutputInterface ;
15- use Magento \Framework \App \Filesystem \DirectoryList ;
1615
1716/**
1817 * Class XmlCatalogGenerateCommand Generates dictionary of URNs for the IDE
@@ -42,9 +41,9 @@ class XmlCatalogGenerateCommand extends Command
4241 private $ urnResolver ;
4342
4443 /**
45- * @var \Magento\Framework\Filesystem\Directory\ReadInterface
44+ * @var \Magento\Framework\Filesystem\Directory\ReadFactory
4645 */
47- private $ rootDirRead ;
46+ private $ readFactory ;
4847
4948 /**
5049 * Supported formats
@@ -56,19 +55,19 @@ class XmlCatalogGenerateCommand extends Command
5655 /**
5756 * @param \Magento\Framework\App\Utility\Files $filesUtility
5857 * @param \Magento\Framework\Config\Dom\UrnResolver $urnResolver
59- * @param \Magento\Framework\Filesystem $filesystemFactory
58+ * @param \Magento\Framework\Filesystem\Directory\ReadFactory $readFactory
6059 * @param \Magento\Developer\Model\XmlCatalog\Format\FormatInterface[] $formats
6160 */
6261 public function __construct (
6362 \Magento \Framework \App \Utility \Files $ filesUtility ,
6463 \Magento \Framework \Config \Dom \UrnResolver $ urnResolver ,
65- \Magento \Framework \Filesystem $ filesystemFactory ,
64+ \Magento \Framework \Filesystem \ Directory \ ReadFactory $ readFactory ,
6665 array $ formats = []
6766 ) {
6867 $ this ->filesUtility = $ filesUtility ;
6968 $ this ->urnResolver = $ urnResolver ;
7069 $ this ->formats = $ formats ;
71- $ this ->rootDirRead = $ filesystemFactory -> getDirectoryRead (DirectoryList:: ROOT ) ;
70+ $ this ->readFactory = $ readFactory ;
7271 parent ::__construct ();
7372 }
7473
@@ -111,9 +110,10 @@ private function getUrnDictionary(OutputInterface $output)
111110
112111 $ urns = [];
113112 foreach ($ files as $ file ) {
114- $ content = $ this ->rootDirRead ->readFile (
115- $ this ->rootDirRead ->getRelativePath ($ file [0 ])
116- );
113+ $ fileDir = dirname ($ file [0 ]);
114+ $ fileName = basename ($ file [0 ]);
115+ $ read = $ this ->readFactory ->create ($ fileDir );
116+ $ content = $ read ->readFile ($ fileName );
117117 $ matches = [];
118118 preg_match_all ('/schemaLocation="(urn\:magento\:[^"]*)"/i ' , $ content , $ matches );
119119 if (isset ($ matches [1 ])) {
0 commit comments