Make compare more compact and add line numbers

This commit is contained in:
Tim
2025-04-24 18:23:57 +02:00
parent d7e558cae9
commit ced70fd650
2 changed files with 8 additions and 11 deletions

View File

@ -187,6 +187,7 @@ class MyersDiff
case DiffTypeEnum::KEEP->value:
for ($i = 0; $i < $data; $i++) {
$lines[] = [
'line' => $x,
'type' => 'keep',
'from' => $a[$x],
'to' => $a[$x],
@ -197,6 +198,7 @@ class MyersDiff
case DiffTypeEnum::DELETE->value:
for ($i = 0; $i < $data; $i++) {
$lines[] = [
'line' => $x,
'type' => 'delete',
'from' => $a[$x],
'to' => '',
@ -207,6 +209,7 @@ class MyersDiff
case DiffTypeEnum::INSERT->value:
foreach ($data as $v) {
$lines[] = [
'line' => $x,
'type' => 'insert',
'from' => '',
'to' => $v,