Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReportsConfigRule.php
Go to the documentation of this file.
1 <?php
7 
12 {
18  private $moduleTableMap;
19 
23  public function __construct(array $tables)
24  {
25  $this->moduleTableMap = $tables;
26  }
27 
31  public function getDependencyInfo($currentModule, $fileType, $file, &$contents)
32  {
33  if ('config' != $fileType || !preg_match('#.*/reports\.xml$#', $file)) {
34  return [];
35  }
36 
37  $dependenciesInfo = [];
38  if (preg_match_all('#<source[^>]*name=[\'"]([^\'"]+)[\'"]#i', $contents, $matches)) {
39  $tables = array_pop($matches);
40  foreach ($tables as $table) {
41  if (!isset($this->moduleTableMap[$table])) {
42  continue;
43  }
44  if (strtolower($currentModule) !== strtolower($this->moduleTableMap[$table])) {
45  $dependenciesInfo[] = [
46  'module' => $this->moduleTableMap[$table],
47  'type' => RuleInterface::TYPE_HARD,
48  'source' => $table,
49  ];
50  }
51  }
52  }
53 
54  return $dependenciesInfo;
55  }
56 }
$contents
Definition: website.php:14
getDependencyInfo($currentModule, $fileType, $file, &$contents)
$table
Definition: trigger.php:14