My problem is that when I run phpcpd command I always get 0% doubled code result, no matter if it's my project, if it's any php module's files, or if it's a file I created to check if phpcpd works...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 isn't it working properly? Or maybe it is supposed to do some other tasks?
PHPCPD is a Copy/Paste Detector (CPD) for PHP code. It allows developers to detect duplicated code in PHP projects in order to clean code and improve maintenance. There is a PHPCPD GitHub project with details about how to use this tool.
From http://www.codediesel.com/tools/detecting-duplicate-code-in-php-files/
By default phpcpd will search for a minimum of 5 identical lines and 70 identical tokens. So if there are less than 5 duplicate lines in the code or less than 70 identical tokens they will be ignored. To override this you can use the –min-lines and –min-tokens switch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With