Skip to content

Commit

Permalink
Preparing release v0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
sohelamin committed May 27, 2018
1 parent 0ed8019 commit 6d7a4e5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ temp
composer.lock
.DS_STORE
generate-phar.php
phpcloc.phar
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
## Installation
### Manual
```
$ wget https://raw.githubusercontent.com/appzcoder/phpcloc/master/phpcloc.phar -O phpcloc
$ wget https://github.com/appzcoder/phpcloc/releases/download/v0.0.2/phpcloc.phar -O phpcloc
// or
$ curl -L https://raw.githubusercontent.com/appzcoder/phpcloc/master/phpcloc.phar -o phpcloc
$ curl -L https://github.com/appzcoder/phpcloc/releases/download/v0.0.2/phpcloc.phar -o phpcloc
```
Then
```
Expand Down
Binary file removed phpcloc.phar
Binary file not shown.
12 changes: 10 additions & 2 deletions src/Analyzers/DuplicateAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ protected function processLines(SplFileObject $file)
$lineNo = ($file->key() + 1);

if ($foundIndex = array_search($trimLine, array_column($lines, 'code'))) {
$duplicates[] = $lines[$foundIndex]['lineNo'];
$foundLineNo = $lines[$foundIndex]['lineNo'];
if (!in_array($foundLineNo, $duplicates)) {
$duplicates[] = $foundLineNo;
}
$duplicates[] = $lineNo;
}

Expand All @@ -87,10 +90,15 @@ protected function processLines(SplFileObject $file)
$totalDuplicates = count($duplicates);
if ($totalDuplicates > 0) {
sort($duplicates);
$duplicatesStr = '';
foreach (array_chunk($duplicates, 10) as $chunk) {
$duplicatesStr .= implode(', ', $chunk) . PHP_EOL;
}

$this->stats[$filename] = [
'file' => $filename,
'duplicate' => $totalDuplicates,
'line_no' => implode(',', $duplicates),
'line_no' => $duplicatesStr,
];
}
}
Expand Down

0 comments on commit 6d7a4e5

Please sign in to comment.