1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
<?php
/**
* Purpose is to demonstrate detection of Type 3 clone, which contains small changes.
*
* ./phpcpd --min-tokens 1 --min-lines 5 tests/fixture/type3_clone.php
* ./phpcpd --algorithm suffixtree --min-tokens 5 --min-lines 5 --head-equality 2 tests/fixture/type3_clone.php
*/
function foo()
{
$a = 10;
$b = 20;
if ($a > $b) {
return 'foo';
} else {
return 'bar';
}
}
function bar()
{
$a = 10;
$b = 20;
if ($a > $b) {
} else {
return 'bar';
}
}
function bar()
{
$a = 10;
$b = '20';
if ($a) {
return 'foo';
} else {
return 'bar';
}
}
|