File tree 2 files changed +21
-4
lines changed
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change
1
+
1
2
# PHPCloc
2
3
:rocket : Cloc & duplicate code checker written in PHP
3
4
@@ -10,15 +11,31 @@ $ composer global require appzcoder/phpcloc
10
11
```
11
12
12
13
## Usage
13
- Cloc
14
+ ### Cloc
14
15
```
15
16
$ phpcloc cloc .
16
17
```
18
+ <img width =" 614 " alt =" cloc " src =" https://user-images.githubusercontent.com/1708683/40279910-0c5d093e-5c6d-11e8-86e8-d78d59a4acbe.png " >
17
19
18
- Duplicate code checker
20
+ ### Duplicate code checker
19
21
```
20
22
$ phpcloc duplicate . --ext=php
21
23
```
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
22
39
23
40
## Author
24
41
Original file line number Diff line number Diff line change @@ -100,12 +100,12 @@ protected function processLines(SplFileObject $file)
100
100
$ isMultilines = false ;
101
101
}
102
102
103
- $ lineProperties ['code ' ] = $ trimLine ;
103
+ $ lineProperties ['code ' ] = $ currentLine ;
104
104
$ lines [] = $ lineProperties ;
105
105
}
106
106
107
107
$ 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 ' ])) {
109
109
return false ;
110
110
}
111
111
You can’t perform that action at this time.
0 commit comments