Make compare more compact and add line numbers
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user