php复制贴贴代码,PHPCPD - PHP代码的复制/粘贴检测器(CPD)

68747470733a2f2f706f7365722e707567782e6f72672f73656261737469616e2f7068706370642f762f737461626c652e706e67e7e492bad75e381828910cb2c622f600.png

PHP Copy/Paste Detector (PHPCPD)

phpcpd is a Copy/Paste Detector (CPD) for PHP code.

Installation

PHP Archive (PHAR)

The easiest way to obtain PHPCPD is to download a PHP Archive (PHAR) that has all required dependencies of PHPCPD bundled in a single file:

wget https://phar.phpunit.de/phpcpd.phar

chmod +x phpcpd.phar

mv phpcpd.phar /usr/local/bin/phpcpd

You can also immediately use the PHAR after you have downloaded it, of course:

wget https://phar.phpunit.de/phpcpd.phar

php phpcpd.phar

Composer

Simply add a dependency on sebastian/phpcpd to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a development-time dependency on PHPCPD:

{

"require-dev": {

"sebastian/phpcpd": "*"

}

}

For a system-wide installation via Composer, you can run:

composer global require "sebastian/phpcpd=*"

Make sure you have ~/.composer/vendor/bin/ in your path.

Usage Example

➜ ~ phpcpd /tmp/wordpress-3.8.1/wp-includes

phpcpd 2.0.1 by Sebastian Bergmann.

Found 34 exact clones with 1273 duplicated lines in 11 files:

- /tmp/wordpress-3.8.1/wp-includes/class-snoopy.php:165-195

/tmp/wordpress-3.8.1/wp-includes/class-snoopy.php:225-255

.

.

.

- /tmp/wordpress-3.8.1/wp-includes/SimplePie/Misc.php:1769-1830

/tmp/wordpress-3.8.1/wp-includes/SimplePie/Parse/Date.php:710-771

0.86% duplicated lines out of 147877 total lines of code.

Time: 24.67 seconds, Memory: 159.00Mb

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值