Skip to content

code clean up #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Feb 20, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
avoid short variable names
  • Loading branch information
JBlond committed Feb 20, 2019
commit f75c8700f3d5770fa24926638cd86d74835a5bf5
28 changes: 14 additions & 14 deletions lib/jblond/Diff/SequenceMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,23 +404,23 @@ public function getMatchingBlocks() : array
while (!empty($queue)) {
list($alo, $ahi, $blo, $bhi) = array_pop($queue);
$longestMatch = $this->findLongestMatch($alo, $ahi, $blo, $bhi);
list($i, $j, $k) = $longestMatch;
if ($k) {
list($list1, $list2, $list3) = $longestMatch;
if ($list3) {
$matchingBlocks[] = $longestMatch;
if ($alo < $i && $blo < $j) {
if ($alo < $list1 && $blo < $list2) {
$queue[] = array(
$alo,
$i,
$list1,
$blo,
$j
$list2
);
}

if ($i + $k < $ahi && $j + $k < $bhi) {
if ($list1 + $list3 < $ahi && $list2 + $list3 < $bhi) {
$queue[] = array(
$i + $k,
$list1 + $list3,
$ahi,
$j + $k,
$list2 + $list3,
$bhi
);
}
Expand All @@ -439,9 +439,9 @@ function ($aArray, $bArray) {
$k1 = 0;
$nonAdjacent = array();
foreach ($matchingBlocks as $block) {
list($i2, $j2, $k2) = $block;
if ($i1 + $k1 == $i2 && $j1 + $k1 == $j2) {
$k1 += $k2;
list($list4, $list5, $list6) = $block;
if ($i1 + $k1 == $list4 && $j1 + $k1 == $list5) {
$k1 += $list6;
} else {
if ($k1) {
$nonAdjacent[] = array(
Expand All @@ -451,9 +451,9 @@ function ($aArray, $bArray) {
);
}

$i1 = $i2;
$j1 = $j2;
$k1 = $k2;
$i1 = $list4;
$j1 = $list5;
$k1 = $list6;
}
}

Expand Down