Skip to content

Commit 8fcc5fb

Browse files
committed
reduce Cyclomatic Complexity
1 parent ede59fb commit 8fcc5fb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,26 @@ public function render(): string
6262
);
6363
foreach ($group as [$tag, $i1, $i2, $j1, $j2]) {
6464
if ($tag == 'equal') {
65-
$diff .= $this->colors->getColoredString(' ' .
66-
implode(
67-
"\n ",
68-
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
69-
) . "\n", 'grey');
65+
$string = implode(
66+
"\n ",
67+
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
68+
);
69+
$diff .= $this->colors->getColoredString(' ' . $string . "\n", 'grey');
7070
continue;
7171
}
7272
if ($tag == 'replace' || $tag == 'delete') {
73-
$diff .= $this->colors->getColoredString('-' .
74-
implode(
75-
"\n- ",
76-
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
77-
) . "\n", 'light_red');
73+
$string = implode(
74+
"\n- ",
75+
$this->diff->getArrayRange($this->diff->getVersion1(), $i1, $i2)
76+
);
77+
$diff .= $this->colors->getColoredString('-' . $string . "\n", 'light_red');
7878
}
7979
if ($tag == 'replace' || $tag == 'insert') {
80-
$diff .= $this->colors->getColoredString('+' .
81-
implode(
82-
"\n+",
83-
$this->diff->getArrayRange($this->diff->getVersion2(), $j1, $j2)
84-
) . "\n", 'light_green');
80+
$string = implode(
81+
"\n+",
82+
$this->diff->getArrayRange($this->diff->getVersion2(), $j1, $j2)
83+
);
84+
$diff .= $this->colors->getColoredString('+' . $string . "\n", 'light_green');
8585
}
8686
}
8787
}

0 commit comments

Comments
 (0)