Giter VIP home page Giter VIP logo

phpcpd's Introduction

Latest Stable Version Build Status

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 http://pear.phpunit.de/get/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 http://pear.phpunit.de/get/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 standalone, system-wide installation via Composer, a composer.json similar to the one shown below can be used from an arbitary directory:

{
    "require": {
        "sebastian/phpcpd": "*"
    },
    "config": {
        "bin-dir": "/usr/local/bin/"
    }
}

PEAR Installer

The following two commands (which you may have to run as root) are all that is required to install PHPCPD using the PEAR Installer:

pear config-set auto_discover 1
pear install pear.phpunit.de/phpcpd

Usage Example

โžœ ~ phpcpd /usr/local/src/phpunit/PHPUnit
phpcpd 1.4.1 by Sebastian Bergmann.

Found 3 exact clones with 53 duplicated lines in 5 files:

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157
    /usr/local/src/phpunit/PHPUnit/Framework/Constraint/And.php:143-164

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157
    /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Xor.php:141-162

  - /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Scalar.php:121-132
    /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Numeric.php:102-113

0.19% duplicated lines out of 27640 total lines of code.

Time: 0 seconds, Memory: 18.25Mb

phpcpd's People

Contributors

aboks avatar alexshadow007 avatar edorian avatar gooh avatar jsobiecki avatar kukulich avatar ocramius avatar petah avatar sebastianbergmann avatar svemir avatar tommygnr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.