diff --git a/lib/jblond/Diff/Renderer/SequenceMatcherHelper.php b/lib/jblond/Diff/DiffUtils.php similarity index 59% rename from lib/jblond/Diff/Renderer/SequenceMatcherHelper.php rename to lib/jblond/Diff/DiffUtils.php index f191599b..2fd26e8d 100644 --- a/lib/jblond/Diff/Renderer/SequenceMatcherHelper.php +++ b/lib/jblond/Diff/DiffUtils.php @@ -1,6 +1,6 @@ b2j, $old[$i], $nothing); + $jDict = $this->b2j[$old[$i]] ?? $nothing; foreach ($jDict as $j) { if ($j < $bLower) { continue; @@ -267,7 +265,7 @@ public function findLongestMatch(int $aLower, int $aUpper, int $bLower, int $bUp break; } - $k = SequenceMatcherHelper::arrayGetDefault($j2Len, $j - 1, 0) + 1; + $k = ($j2Len[$j - 1] ?? 0) + 1; $newJ2Len[$j] = $k; if ($k > $bestSize) { $bestI = $i - $k + 1; @@ -414,7 +412,7 @@ public function getMatchingBlocks(): array usort( $matchingBlocks, function ($aArray, $bArray) { - return SequenceMatcherHelper::tupleSort($aArray, $bArray); + return DiffUtils::tupleSort($aArray, $bArray); } );