Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ChangeDetector.php
Go to the documentation of this file.
1 <?php
7 
9 
17 {
23  private $configHash;
24 
30  private $hashGenerator;
31 
37  private $dataConfigCollector;
38 
44  public function __construct(
45  Hash $configHash,
46  HashGenerator $hashGenerator,
47  DataCollector $dataConfigCollector
48  ) {
49  $this->configHash = $configHash;
50  $this->hashGenerator = $hashGenerator;
51  $this->dataConfigCollector = $dataConfigCollector;
52  }
53 
65  public function hasChanges($sectionName = null)
66  {
67  $configs = $this->dataConfigCollector->getConfig($sectionName);
68  $hashes = $this->configHash->get();
69 
70  foreach ($configs as $section => $config) {
71  if (null === $config) {
72  continue;
73  }
74  $savedHash = isset($hashes[$section]) ? $hashes[$section] : null;
75  $generatedHash = empty($config) && !$savedHash ? null : $this->hashGenerator->generate($config);
76  if ($generatedHash !== $savedHash) {
77  return true;
78  }
79  }
80 
81  return false;
82  }
83 }
__construct(Hash $configHash, HashGenerator $hashGenerator, DataCollector $dataConfigCollector)
$config
Definition: fraud_order.php:17