Skip to content

Commit

Permalink
📄 update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sohelamin committed May 20, 2018
1 parent 6219ecf commit 6c947d3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# PHPCloc
:rocket: Cloc & duplicate code checker written in PHP

Expand All @@ -10,15 +11,31 @@ $ composer global require appzcoder/phpcloc
```

## Usage
Cloc
### Cloc
```
$ phpcloc cloc .
```
<img width="614" alt="cloc" src="https://user-images.githubusercontent.com/1708683/40279910-0c5d093e-5c6d-11e8-86e8-d78d59a4acbe.png">

Duplicate code checker
### Duplicate code checker
```
$ phpcloc duplicate . --ext=php
```
<img width="935" alt="duplicate" src="https://user-images.githubusercontent.com/1708683/40279915-21336d30-5c6d-11e8-910c-e56e1349f5a6.png">

#### Available Commands
```
$ phpcloc cloc directory --ext=php,js --exclude=vendor,node_modules
```

```
$ phpcloc duplicate directory --ext=php --exclude=vendor
```

## Todo
- Line number show on duplicate code checker command
- Improve algorithm complexity
- Testing

## Author

Expand Down
4 changes: 2 additions & 2 deletions src/Analyzers/DuplicateAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ protected function processLines(SplFileObject $file)
$isMultilines = false;
}

$lineProperties['code'] = $trimLine;
$lineProperties['code'] = $currentLine;
$lines[] = $lineProperties;
}

$code = array_filter($lines, function ($line) {
if (isset($line['blank']) || isset($line['comment']) || in_array($line['code'], ['{', '}'])) {
if (isset($line['blank']) || isset($line['comment'])) {
return false;
}

Expand Down

0 comments on commit 6c947d3

Please sign in to comment.