Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InterceptedInstancesScanner.php
Go to the documentation of this file.
1 <?php
8 
10 {
17  public function collectEntities(array $files)
18  {
19  $interceptedInstances = [];
20  foreach ($files as $fileName) {
21  $dom = new \DOMDocument();
22  $dom->loadXML(file_get_contents($fileName));
23  $xpath = new \DOMXPath($dom);
25  foreach ($xpath->query('//type/plugin|//virtualType/plugin') as $node) {
26  $parentTypeNode = $node->parentNode->attributes->getNamedItem('name');
27  if ($parentTypeNode === null) {
28  continue;
29  }
30 
31  if (!isset($interceptedInstances[$parentTypeNode->nodeValue])) {
32  $interceptedInstances[$parentTypeNode->nodeValue] = [];
33  }
34 
35  $pluginTypeNode = $node->attributes->getNamedItem('type');
36  if ($pluginTypeNode !== null) {
37  $interceptedInstances[$parentTypeNode->nodeValue][] = $pluginTypeNode->nodeValue;
38  }
39  }
40  }
41  return $interceptedInstances;
42  }
43 }
$fileName
Definition: translate.phtml:15
foreach($appDirs as $dir) $files