Skip to content

Commit b48cbe6

Browse files
committed
refactor variable names
1 parent a1e61fb commit b48cbe6

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

lib/jblond/Diff/SequenceMatcher.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -237,32 +237,32 @@ private function isBJunk(string $bString): bool
237237
* that the junk element appears in the block. Extend it as far as possible
238238
* by matching only junk elements in both $a and $b.
239239
*
240-
* @param int $alo The lower constraint for the first sequence.
241-
* @param int $ahi The upper constraint for the first sequence.
242-
* @param int $blo The lower constraint for the second sequence.
243-
* @param int $bhi The upper constraint for the second sequence.
240+
* @param int $aLower The lower constraint for the first sequence.
241+
* @param int $aUpper The upper constraint for the first sequence.
242+
* @param int $bLower The lower constraint for the second sequence.
243+
* @param int $bUpper The upper constraint for the second sequence.
244244
* @return array Array containing the longest match that includes the starting position in $a,
245245
* start in $b and the length/size.
246246
*/
247-
public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
247+
public function findLongestMatch(int $aLower, int $aUpper, int $bLower, int $bUpper): array
248248
{
249249
$old = $this->old;
250250
$new = $this->new;
251251

252-
$bestI = $alo;
253-
$bestJ = $blo;
252+
$bestI = $aLower;
253+
$bestJ = $bLower;
254254
$bestSize = 0;
255255

256256
$j2Len = [];
257257
$nothing = [];
258258

259-
for ($i = $alo; $i < $ahi; ++$i) {
259+
for ($i = $aLower; $i < $aUpper; ++$i) {
260260
$newJ2Len = [];
261261
$jDict = $this->arrayGetDefault($this->b2j, $old[$i], $nothing);
262262
foreach ($jDict as $j) {
263-
if ($j < $blo) {
263+
if ($j < $bLower) {
264264
continue;
265-
} elseif ($j >= $bhi) {
265+
} elseif ($j >= $bUpper) {
266266
break;
267267
}
268268

@@ -279,8 +279,8 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
279279
}
280280

281281
while (
282-
$bestI > $alo &&
283-
$bestJ > $blo &&
282+
$bestI > $aLower &&
283+
$bestJ > $bLower &&
284284
!$this->isBJunk($new[$bestJ - 1]) &&
285285
!$this->linesAreDifferent($bestI - 1, $bestJ - 1)
286286
) {
@@ -290,17 +290,17 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
290290
}
291291

292292
while (
293-
$bestI + $bestSize < $ahi &&
294-
($bestJ + $bestSize) < $bhi &&
293+
$bestI + $bestSize < $aUpper &&
294+
($bestJ + $bestSize) < $bUpper &&
295295
!$this->isBJunk($new[$bestJ + $bestSize]) &&
296296
!$this->linesAreDifferent($bestI + $bestSize, $bestJ + $bestSize)
297297
) {
298298
++$bestSize;
299299
}
300300

301301
while (
302-
$bestI > $alo &&
303-
$bestJ > $blo &&
302+
$bestI > $aLower &&
303+
$bestJ > $bLower &&
304304
$this->isBJunk($new[$bestJ - 1]) &&
305305
!$this->linesAreDifferent($bestI - 1, $bestJ - 1)
306306
) {
@@ -310,8 +310,8 @@ public function findLongestMatch(int $alo, int $ahi, int $blo, int $bhi): array
310310
}
311311

312312
while (
313-
$bestI + $bestSize < $ahi &&
314-
$bestJ + $bestSize < $bhi &&
313+
$bestI + $bestSize < $aUpper &&
314+
$bestJ + $bestSize < $bUpper &&
315315
$this->isBJunk($new[$bestJ + $bestSize]) &&
316316
!$this->linesAreDifferent($bestI + $bestSize, $bestJ + $bestSize)
317317
) {
@@ -385,26 +385,26 @@ public function getMatchingBlocks(): array
385385

386386
$matchingBlocks = [];
387387
while (!empty($queue)) {
388-
[$alo, $ahi, $blo, $bhi] = array_pop($queue);
389-
$longestMatch = $this->findLongestMatch($alo, $ahi, $blo, $bhi);
388+
[$aLower, $aUpper, $bLower, $bUpper] = array_pop($queue);
389+
$longestMatch = $this->findLongestMatch($aLower, $aUpper, $bLower, $bUpper);
390390
[$list1, $list2, $list3] = $longestMatch;
391391
if ($list3) {
392392
$matchingBlocks[] = $longestMatch;
393-
if ($alo < $list1 && $blo < $list2) {
393+
if ($aLower < $list1 && $bLower < $list2) {
394394
$queue[] = [
395-
$alo,
395+
$aLower,
396396
$list1,
397-
$blo,
397+
$bLower,
398398
$list2
399399
];
400400
}
401401

402-
if ($list1 + $list3 < $ahi && $list2 + $list3 < $bhi) {
402+
if ($list1 + $list3 < $aUpper && $list2 + $list3 < $bUpper) {
403403
$queue[] = [
404404
$list1 + $list3,
405-
$ahi,
405+
$aUpper,
406406
$list2 + $list3,
407-
$bhi
407+
$bUpper
408408
];
409409
}
410410
}

0 commit comments

Comments
 (0)