本文整理汇总了PHP中Magento\Framework\App\Utility\Files::getXmlCatalogFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP Files::getXmlCatalogFiles方法的具体用法?PHP Files::getXmlCatalogFiles怎么用?PHP Files::getXmlCatalogFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\App\Utility\Files
的用法示例。
在下文中一共展示了Files::getXmlCatalogFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrnDictionary
/**
* Get an array of URNs
*
* @param OutputInterface $output
* @return array
*/
private function getUrnDictionary(OutputInterface $output)
{
$files = $this->filesUtility->getXmlCatalogFiles('*.xml');
$files = array_merge($files, $this->filesUtility->getXmlCatalogFiles('*.xsd'));
$urns = [];
foreach ($files as $file) {
$content = $this->rootDirRead->readFile($this->rootDirRead->getRelativePath($file[0]));
$matches = [];
preg_match_all('/schemaLocation="(urn\\:magento\\:[^"]*)"/i', $content, $matches);
if (isset($matches[1])) {
$urns = array_merge($urns, $matches[1]);
}
}
$urns = array_unique($urns);
$paths = [];
foreach ($urns as $urn) {
try {
$paths[$urn] = $this->urnResolver->getRealPath($urn);
} catch (\Exception $e) {
// don't add unsupported element to array
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$output->writeln($e->getMessage());
}
}
}
return $paths;
}
示例2: testGetXmlCatalogFiles
public function testGetXmlCatalogFiles()
{
$actual = $this->model->getXmlCatalogFiles('*.xml');
$this->assertNotEmpty($actual);
foreach ($actual as $file) {
$this->assertStringEndsWith('.xml', $file[0]);
}
$actual = $this->model->getXmlCatalogFiles('*.xsd');
$this->assertNotEmpty($actual);
foreach ($actual as $file) {
$this->assertStringEndsWith('.xsd', $file[0]);
}
}