|
1 | 1 | <?php
|
| 2 | + |
2 | 3 | /**
|
3 | 4 | * Copyright © Magento, Inc. All rights reserved.
|
4 | 5 | * See COPYING.txt for license details.
|
|
14 | 15 | */
|
15 | 16 | abstract class AbstractEntityAnalyzer
|
16 | 17 | {
|
17 |
| - const DEFAULT_OPERATION_KEY = '*'; |
| 18 | + public const DEFAULT_OPERATION_KEY = '*'; |
18 | 19 |
|
19 | 20 | /**
|
20 | 21 | * @var Report
|
@@ -69,8 +70,10 @@ public function findMatchingElementByKeyAndValue($beforeElement, $afterElements,
|
69 | 70 | $beforeFieldKey = $beforeElement['attributes'][$elementIdentifier];
|
70 | 71 | $beforeFieldValue = $beforeElement['value'];
|
71 | 72 | foreach ($afterElements as $afterElement) {
|
72 |
| - if ($afterElement['attributes'][$elementIdentifier] === $beforeFieldKey |
73 |
| - && $afterElement['value'] === $beforeFieldValue) { |
| 73 | + if ( |
| 74 | + $afterElement['attributes'][$elementIdentifier] === $beforeFieldKey |
| 75 | + && $afterElement['value'] === $beforeFieldValue |
| 76 | + ) { |
74 | 77 | return $afterElement;
|
75 | 78 | }
|
76 | 79 | }
|
@@ -185,19 +188,19 @@ public function findAddedElementsInArray(
|
185 | 188 | $operationClass,
|
186 | 189 | $fullOperationTarget
|
187 | 190 | ) {
|
188 |
| - if (is_array($afterArray) || is_object($afterArray)) { |
189 |
| - foreach ($afterArray as $newChild) { |
190 |
| - if (!isset($newChild['attributes'][$elementIdentifier])) { |
191 |
| - continue; |
192 |
| - } |
193 |
| - $afterFieldKey = $newChild['attributes'][$elementIdentifier]; |
194 |
| - $matchingElement = $this->findMatchingElement($newChild, $beforeArray, $elementIdentifier); |
195 |
| - if ($matchingElement === null) { |
196 |
| - $operation = new $operationClass($filenames, $fullOperationTarget . '/' . $afterFieldKey); |
197 |
| - $report->add(MftfReport::MFTF_REPORT_CONTEXT, $operation); |
198 |
| - } |
| 191 | + if (is_array($afterArray) || is_object($afterArray)) { |
| 192 | + foreach ($afterArray as $newChild) { |
| 193 | + if (!isset($newChild['attributes'][$elementIdentifier])) { |
| 194 | + continue; |
| 195 | + } |
| 196 | + $afterFieldKey = $newChild['attributes'][$elementIdentifier]; |
| 197 | + $matchingElement = $this->findMatchingElement($newChild, $beforeArray, $elementIdentifier); |
| 198 | + if ($matchingElement === null) { |
| 199 | + $operation = new $operationClass($filenames, $fullOperationTarget . '/' . $afterFieldKey); |
| 200 | + $report->add(MftfReport::MFTF_REPORT_CONTEXT, $operation); |
199 | 201 | }
|
200 | 202 | }
|
| 203 | + } |
201 | 204 | }
|
202 | 205 | /**
|
203 | 206 | * Finds all added child elements in afterArray, compared to beforeArray, using both key and value for matching
|
|
0 commit comments