@@ -193,7 +193,7 @@ |
||
193 | 193 | $leftLength = $leftEnd - $leftStart; |
194 | 194 | $rightLength = $rightEnd - $rightStart; |
195 | 195 | |
196 | - while ($i + 1 < $iMax |
|
196 | + while ($i + 1 < $iMax |
|
197 | 197 | && $differences[$i + 1]->kind() == $kind |
198 | 198 | && $this->score($leftLength, $differences[$i + 1]->leftLength(), |
199 | 199 | $rightLength, $differences[$i + 1]->rightLength()) > ($differences[$i + 1]->leftStart() - $leftEnd)) { |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | $this->attributes = $attributes; |
23 | 23 | |
24 | - $src = array_key_exists('src', $this->attributes)? mb_strtolower($this->attributes['src']) : ''; |
|
24 | + $src = array_key_exists('src', $this->attributes) ? mb_strtolower($this->attributes['src']) : ''; |
|
25 | 25 | parent::__construct($parent, "<img>{$src}</img>"); |
26 | 26 | } |
27 | 27 |
@@ -36,8 +36,7 @@ |
||
36 | 36 | foreach ($tree as $child) { |
37 | 37 | if ($child instanceof TagNode) { |
38 | 38 | $this->addRecursive($child); |
39 | - } |
|
40 | - elseif ($child instanceof TextNode) { |
|
39 | + } elseif ($child instanceof TextNode) { |
|
41 | 40 | $this->leafs[] = $child; |
42 | 41 | } |
43 | 42 | } |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | // The difference is in the parent, so compare them. now THIS is tricky. |
384 | 384 | $distancePrev = $deletedNodes[0]->getParent()->getMatchRatio($prevResult->getLastCommonParent()); |
385 | 385 | $distanceNext = $deletedNodes[count($deletedNodes) - 1]->getParent() |
386 | - ->getMatchRatio($nextResult->getLastCommonParent()); |
|
386 | + ->getMatchRatio($nextResult->getLastCommonParent()); |
|
387 | 387 | |
388 | 388 | if ($distancePrev <= $distanceNext) { |
389 | 389 | // Insert after the previous node. |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | // Inserting at the back. |
410 | 410 | if ($nextResult->isSplittingNeeded()) { |
411 | 411 | $splitOccurred = $nextLeaf->getParent() |
412 | - ->splitUntil($nextResult->getLastCommonParent(), $nextLeaf, false); |
|
412 | + ->splitUntil($nextResult->getLastCommonParent(), $nextLeaf, false); |
|
413 | 413 | |
414 | 414 | if ($splitOccurred) { |
415 | 415 | // The place where to insert is shifted one place to the right. |
@@ -159,8 +159,8 @@ |
||
159 | 159 | if ($s1 != -1 && |
160 | 160 | ($s1 + 1 < $this->comparator1->getRangeCount() || $s2 + 1 < $this->comparator2->getRangeCount())) { |
161 | 161 | // TODO: we need to find the proper way of representing an append. |
162 | - $leftStart = $s1 < $this->comparator1->getRangeCount()? $s1 + 1 : $s1; |
|
163 | - $rightStart = $s2 < $this->comparator2->getRangeCount()? $s2 + 1 : $s2; |
|
162 | + $leftStart = $s1 < $this->comparator1->getRangeCount() ? $s1 + 1 : $s1; |
|
163 | + $rightStart = $s2 < $this->comparator2->getRangeCount() ? $s2 + 1 : $s2; |
|
164 | 164 | |
165 | 165 | // TODO: We need to confirm that this is the proper order. |
166 | 166 | $differences[] = new RangeDifference( |
@@ -135,8 +135,7 @@ |
||
135 | 135 | // There is a diff at the beginning. |
136 | 136 | // TODO: We need to confirm that this is the proper order. |
137 | 137 | $differences[] = new RangeDifference(RangeDifference::CHANGE, 0, $end2, 0, $end1); |
138 | - } |
|
139 | - elseif ($end1 != $s1 + 1 || $end2 != $s2 + 1) { |
|
138 | + } elseif ($end1 != $s1 + 1 || $end2 != $s2 + 1) { |
|
140 | 139 | // A diff was found on one of the sides. |
141 | 140 | $leftStart = $s1 + 1; |
142 | 141 | $leftLength = $end1 - $leftStart; |
@@ -101,11 +101,9 @@ |
||
101 | 101 | // Take the next diff that is closer to the start. |
102 | 102 | if (null === $myIter->getDifference()) { |
103 | 103 | $startThread = $yourIter; |
104 | - } |
|
105 | - elseif (null === $yourIter->getDifference()) { |
|
104 | + } elseif (null === $yourIter->getDifference()) { |
|
106 | 105 | $startThread = $myIter; |
107 | - } |
|
108 | - else { |
|
106 | + } else { |
|
109 | 107 | // Not at end of both scripts take the lowest range. |
110 | 108 | if ($myIter->getDifference()->leftStart() <= $yourIter->getDifference()->leftStart()) { |
111 | 109 | $startThread = $myIter; |
@@ -62,8 +62,8 @@ |
||
62 | 62 | $max = min($length1, $length2); |
63 | 63 | |
64 | 64 | for ($forwardBound = 0; |
65 | - $forwardBound < $max && $this->isRangeEqual($forwardBound, $forwardBound); |
|
66 | - $forwardBound++) { |
|
65 | + $forwardBound < $max && $this->isRangeEqual($forwardBound, $forwardBound); |
|
66 | + $forwardBound++) { |
|
67 | 67 | $this->setLcs($forwardBound, $forwardBound); |
68 | 68 | } |
69 | 69 |
@@ -162,14 +162,14 @@ |
||
162 | 162 | $M = $topL2 - $bottomL2 + 1; |
163 | 163 | |
164 | 164 | $delta = $N - $M; |
165 | - $isEven = ($delta & 1) == 1? false : true; |
|
165 | + $isEven = ($delta & 1) == 1 ? false : true; |
|
166 | 166 | |
167 | 167 | $limit = min($this->maxDifferences, intval(ceil(($N + $M + 1) / 2))); |
168 | 168 | |
169 | 169 | // Offset to make it odd/even. |
170 | 170 | // a 0 or 1 that we add to the start offset to make it odd/even |
171 | - $valueToAddForward = ($M & 1) == 1? 1 : 0; |
|
172 | - $valueToAddBackward = ($N & 1) == 1? 1 : 0; |
|
171 | + $valueToAddForward = ($M & 1) == 1 ? 1 : 0; |
|
172 | + $valueToAddBackward = ($N & 1) == 1 ? 1 : 0; |
|
173 | 173 | |
174 | 174 | $startForward = -$M; |
175 | 175 | $endForward = $N; |
@@ -253,8 +253,7 @@ discard block |
||
253 | 253 | if ($x <= 0) { |
254 | 254 | $startBackward = $k + 1; |
255 | 255 | $valueToAddBackward = 0; |
256 | - } |
|
257 | - elseif ($y <= 0 && $endBackward > $k - 1) { |
|
256 | + } elseif ($y <= 0 && $endBackward > $k - 1) { |
|
258 | 257 | $endBackward = $k - 1; |
259 | 258 | } |
260 | 259 | } |
@@ -324,8 +323,7 @@ discard block |
||
324 | 323 | $maxProgress[0][0] = $x; |
325 | 324 | $maxProgress[0][1] = $y; |
326 | 325 | $maxProgress[0][2] = $progress; |
327 | - } |
|
328 | - elseif ($progress == $maxProgress[0][2]) { |
|
326 | + } elseif ($progress == $maxProgress[0][2]) { |
|
329 | 327 | $numProgress++; |
330 | 328 | $maxProgress[$numProgress][0] = $x; |
331 | 329 | $maxProgress[$numProgress][1] = $y; |
@@ -353,8 +351,7 @@ discard block |
||
353 | 351 | $maxProgress[0][0] = $x; |
354 | 352 | $maxProgress[0][1] = $y; |
355 | 353 | $maxProgress[0][2] = $progress; |
356 | - } |
|
357 | - elseif ($progress == $maxProgress[0][2] && !$maxProgressForward) { |
|
354 | + } elseif ($progress == $maxProgress[0][2] && !$maxProgressForward) { |
|
358 | 355 | $numProgress++; |
359 | 356 | $maxProgress[$numProgress][0] = $x; |
360 | 357 | $maxProgress[$numProgress][1] = $y; |
@@ -63,8 +63,8 @@ |
||
63 | 63 | $lastDiagonal[$origin] = $row; |
64 | 64 | $script[$origin] = null; |
65 | 65 | |
66 | - $lower = ($row == $rightSize)? $origin + 1 : $origin - 1; |
|
67 | - $upper = ($row == $leftSize)? $origin - 1 : $origin + 1; |
|
66 | + $lower = ($row == $rightSize) ? $origin + 1 : $origin - 1; |
|
67 | + $upper = ($row == $leftSize) ? $origin - 1 : $origin + 1; |
|
68 | 68 | |
69 | 69 | if ($lower > $upper) { |
70 | 70 | return []; |
@@ -206,12 +206,12 @@ |
||
206 | 206 | public function equals(RangeDifference $other): bool |
207 | 207 | { |
208 | 208 | return |
209 | - $this->kind == $other->kind() && |
|
210 | - $this->leftStart == $other->leftStart() && |
|
211 | - $this->leftLength == $other->leftLength() && |
|
212 | - $this->rightStart == $other->rightStart() && |
|
213 | - $this->rightLength == $other->rightLength() && |
|
214 | - $this->ancestorStart == $other->ancestorStart() && |
|
209 | + $this->kind == $other->kind() && |
|
210 | + $this->leftStart == $other->leftStart() && |
|
211 | + $this->leftLength == $other->leftLength() && |
|
212 | + $this->rightStart == $other->rightStart() && |
|
213 | + $this->rightLength == $other->rightLength() && |
|
214 | + $this->ancestorStart == $other->ancestorStart() && |
|
215 | 215 | $this->ancestorLength == $other->ancestorLength() |
216 | 216 | ; |
217 | 217 | } |