Skip to content

Commit 6d7a4e5

Browse files
committed
Preparing release v0.0.2
1 parent 0ed8019 commit 6d7a4e5

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ temp
33
composer.lock
44
.DS_STORE
55
generate-phar.php
6+
phpcloc.phar

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
## Installation
99
### Manual
1010
```
11-
$ wget https://raw.githubusercontent.com/appzcoder/phpcloc/master/phpcloc.phar -O phpcloc
11+
$ wget https://github.com/appzcoder/phpcloc/releases/download/v0.0.2/phpcloc.phar -O phpcloc
1212
// or
13-
$ curl -L https://raw.githubusercontent.com/appzcoder/phpcloc/master/phpcloc.phar -o phpcloc
13+
$ curl -L https://github.com/appzcoder/phpcloc/releases/download/v0.0.2/phpcloc.phar -o phpcloc
1414
```
1515
Then
1616
```

phpcloc.phar

-1.05 MB
Binary file not shown.

src/Analyzers/DuplicateAnalyzer.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ protected function processLines(SplFileObject $file)
7272
$lineNo = ($file->key() + 1);
7373

7474
if ($foundIndex = array_search($trimLine, array_column($lines, 'code'))) {
75-
$duplicates[] = $lines[$foundIndex]['lineNo'];
75+
$foundLineNo = $lines[$foundIndex]['lineNo'];
76+
if (!in_array($foundLineNo, $duplicates)) {
77+
$duplicates[] = $foundLineNo;
78+
}
7679
$duplicates[] = $lineNo;
7780
}
7881

@@ -87,10 +90,15 @@ protected function processLines(SplFileObject $file)
8790
$totalDuplicates = count($duplicates);
8891
if ($totalDuplicates > 0) {
8992
sort($duplicates);
93+
$duplicatesStr = '';
94+
foreach (array_chunk($duplicates, 10) as $chunk) {
95+
$duplicatesStr .= implode(', ', $chunk) . PHP_EOL;
96+
}
97+
9098
$this->stats[$filename] = [
9199
'file' => $filename,
92100
'duplicate' => $totalDuplicates,
93-
'line_no' => implode(',', $duplicates),
101+
'line_no' => $duplicatesStr,
94102
];
95103
}
96104
}

0 commit comments

Comments
 (0)