Skip to content

Commit 839b0f0

Browse files
committed
Fix PHPMD warnings
1 parent d62afcf commit 839b0f0

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

lib/jblond/Diff/Renderer/Text/Unified.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,38 +40,38 @@ public function render()
4040
continue;
4141
}
4242
$lastItem = array_key_last($group);
43-
$i1 = $group[0][1];
44-
$i2 = $group[$lastItem][2];
45-
$j1 = $group[0][3];
46-
$j2 = $group[$lastItem][4];
43+
$iGroup1 = $group[0][1];
44+
$iGroup2 = $group[$lastItem][2];
45+
$jGroup1 = $group[0][3];
46+
$jGroup2 = $group[$lastItem][4];
4747

48-
if ($i1 == 0 && $i2 == 0) {
49-
$i1 = -1;
50-
$i2 = -1;
48+
if ($iGroup1 == 0 && $iGroup2 == 0) {
49+
$iGroup1 = -1;
50+
$iGroup2 = -1;
5151
}
5252

53-
$diff .= '@@ -' . ($i1 + 1) . ',' . ($i2 - $i1) . ' +' . ($j1 + 1) . ',' . ($j2 - $j1) . " @@\n";
54-
foreach ($group as [$tag, $i1, $i2, $j1, $j2]) {
53+
$diff .= '@@ -' . ($iGroup1 + 1) . ',' . ($iGroup2 - $iGroup1) . ' +' . ($jGroup1 + 1) . ',' . ($jGroup2 - $jGroup1) . " @@\n";
54+
foreach ($group as [$tag, $iGroup1, $iGroup2, $jGroup1, $jGroup2]) {
5555
if ($tag == 'equal') {
5656
$diff .= ' ' .
5757
implode(
5858
"\n ",
59-
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
59+
$this->diff->getArrayRange($this->diff->getVersion1(), $iGroup1, $iGroup2)
6060
) . "\n";
6161
continue;
6262
}
6363
if ($tag == 'replace' || $tag == 'delete') {
6464
$diff .= '-' .
6565
implode(
6666
"\n-",
67-
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
67+
$this->diff->getArrayRange($this->diff->getVersion1(), $iGroup1, $iGroup2)
6868
) . "\n";
6969
}
7070
if ($tag == 'replace' || $tag == 'insert') {
7171
$diff .= '+' .
7272
implode(
7373
"\n+",
74-
$this->diff->getArrayRange($this->diff->getVersion2(), $j1, $j2)
74+
$this->diff->getArrayRange($this->diff->getVersion2(), $jGroup1, $jGroup2)
7575
) . "\n";
7676
}
7777
}

lib/jblond/Diff/Renderer/Text/UnifiedCli.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,41 +71,41 @@ private function output(): string
7171
continue;
7272
}
7373
$lastItem = array_key_last($group);
74-
$i1 = $group[0][1];
75-
$i2 = $group[$lastItem][2];
76-
$j1 = $group[0][3];
77-
$j2 = $group[$lastItem][4];
74+
$iGroup1 = $group[0][1];
75+
$iGroup2 = $group[$lastItem][2];
76+
$jGroup1 = $group[0][3];
77+
$jGroup2 = $group[$lastItem][4];
7878

79-
if ($i1 == 0 && $i2 == 0) {
80-
$i1 = -1;
81-
$i2 = -1;
79+
if ($iGroup1 == 0 && $iGroup2 == 0) {
80+
$iGroup1 = -1;
81+
$iGroup2 = -1;
8282
}
8383

8484
$diff .= $this->colorizeString(
85-
'@@ -' . ($i1 + 1) . ',' . ($i2 - $i1) . ' +' . ($j1 + 1) . ',' . ($j2 - $j1) . " @@\n",
85+
'@@ -' . ($iGroup1 + 1) . ',' . ($iGroup2 - $iGroup1) . ' +' . ($jGroup1 + 1) . ',' . ($jGroup2 - $jGroup1) . " @@\n",
8686
'purple'
8787
);
8888

89-
foreach ($group as [$tag, $i1, $i2, $j1, $j2]) {
89+
foreach ($group as [$tag, $iGroup1, $iGroup2, $jGroup1, $jGroup2]) {
9090
if ($tag == 'equal') {
9191
$string = implode(
9292
"\n ",
93-
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
93+
$this->diff->getArrayRange($this->diff->getVersion1(), $iGroup1, $iGroup2)
9494
);
9595
$diff .= $this->colorizeString(' ' . $string . "\n", 'grey');
9696
continue;
9797
}
9898
if ($tag == 'replace' || $tag == 'delete') {
9999
$string = implode(
100100
"\n- ",
101-
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
101+
$this->diff->getArrayRange($this->diff->getVersion1(), $iGroup1, $iGroup2)
102102
);
103103
$diff .= $this->colorizeString('-' . $string . "\n", 'light_red');
104104
}
105105
if ($tag == 'replace' || $tag == 'insert') {
106106
$string = implode(
107107
"\n+",
108-
$this->diff->getArrayRange($this->diff->getVersion2(), $j1, $j2)
108+
$this->diff->getArrayRange($this->diff->getVersion2(), $jGroup1, $jGroup2)
109109
);
110110
$diff .= $this->colorizeString('+' . $string . "\n", 'light_green');
111111
}

0 commit comments

Comments
 (0)