本文整理匯總了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]);
}
}