We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b8da742 commit 0fa4b45Copy full SHA for 0fa4b45
src/Analyzers/DuplicateAnalyzer.php
@@ -71,19 +71,16 @@ protected function processLines(SplFileObject $file)
71
$trimLine = trim($line);
72
$lineNo = ($file->key() + 1);
73
74
- if ($foundIndex = array_search($trimLine, array_column($lines, 'code'))) {
75
- $foundLineNo = $lines[$foundIndex]['lineNo'];
+ if (isset($lines[$trimLine])) {
+ $foundLineNo = $lines[$trimLine];
76
if (!in_array($foundLineNo, $duplicates)) {
77
$duplicates[] = $foundLineNo;
78
}
79
- $duplicates[] = $lineNo;
80
- }
81
82
- if (strlen($trimLine) > 3) {
83
- $lines[] = [
84
- 'lineNo' => $lineNo,
85
- 'code' => $trimLine,
86
- ];
+ $duplicates[] = $lineNo;
+ } else if (strlen($trimLine) > 3) {
+ // Non duplicate first line
+ $lines[$trimLine] = $lineNo;
87
88
89
0 commit comments