File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1+
12# PHPCloc
23:rocket : Cloc & duplicate code checker written in PHP
34
@@ -10,15 +11,31 @@ $ composer global require appzcoder/phpcloc
1011```
1112
1213## Usage
13- Cloc
14+ ### Cloc
1415```
1516$ phpcloc cloc .
1617```
18+ <img width =" 614 " alt =" cloc " src =" https://user-images.githubusercontent.com/1708683/40279910-0c5d093e-5c6d-11e8-86e8-d78d59a4acbe.png " >
1719
18- Duplicate code checker
20+ ### Duplicate code checker
1921```
2022$ phpcloc duplicate . --ext=php
2123```
24+ <img width =" 935 " alt =" duplicate " src =" https://user-images.githubusercontent.com/1708683/40279915-21336d30-5c6d-11e8-910c-e56e1349f5a6.png " >
25+
26+ #### Available Commands
27+ ```
28+ $ phpcloc cloc directory --ext=php,js --exclude=vendor,node_modules
29+ ```
30+
31+ ```
32+ $ phpcloc duplicate directory --ext=php --exclude=vendor
33+ ```
34+
35+ ## Todo
36+ - Line number show on duplicate code checker command
37+ - Improve algorithm complexity
38+ - Testing
2239
2340## Author
2441
Original file line number Diff line number Diff line change @@ -100,12 +100,12 @@ protected function processLines(SplFileObject $file)
100100 $ isMultilines = false ;
101101 }
102102
103- $ lineProperties ['code ' ] = $ trimLine ;
103+ $ lineProperties ['code ' ] = $ currentLine ;
104104 $ lines [] = $ lineProperties ;
105105 }
106106
107107 $ code = array_filter ($ lines , function ($ line ) {
108- if (isset ($ line ['blank ' ]) || isset ($ line ['comment ' ]) || in_array ( $ line [ ' code ' ], [ ' { ' , ' } ' ]) ) {
108+ if (isset ($ line ['blank ' ]) || isset ($ line ['comment ' ])) {
109109 return false ;
110110 }
111111
You can’t perform that action at this time.
0 commit comments