PHP code cartridge

My problem is that when I run the phpcpd command, I always get 0% double the result of the code, whether it is my project, if it is any php module files, or if it is a file that I created to check does phpcpd work ... For example, when I check the file below, it also displays 0%:

phpcpd folder / file.php:

<?php class Class_Two { public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; echo 'ok'; } } } class Class_Two { public function aaa() { if(2 == 2) { echo 'ok'; } } public function aaa() { if(2 == 2) { echo 'ok'; } } } 

Any suggestions on why it is not working properly? Or perhaps he should perform other tasks?

+4
source share
3 answers

Try running it in a folder, not a file:

 phpcpd /folder/ 
+1
source

From http://www.codediesel.com/tools/detecting-duplicate-code-in-php-files/

By default, phpcpd will look for a minimum of 5 identical lines and 70 identical tokens. Therefore, if the list has less than 5 duplicate lines of code or less than 70 identical tokens, they will be ignored. to override this, you can use the -min-lines and -min-tokens switch.

+4
source

Oh, I tried both, and no one works ... I mean, I always get 0 double lines, even if I make a lot of the same lines in a file.

When I type --min-lines 1 --min-tokens 1, however, I get two notifications: Undefined offset in C: /php/pear/PHPCPD/Detector/Strategy/Default.php on line 106 ...

0
source

All Articles