github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

sebastianbergmann / phpcpd

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 48
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (3)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (8)
    • 1.3.1
    • 1.3.0
    • 1.2.2
    • 1.2.1
    • 1.2.0
    • 1.1.1
    • 1.1.0
    • 1.0.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Copy/Paste Detector (CPD) for PHP code. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Prepare release. 
sebastianbergmann (author)
Tue Feb 09 01:06:06 -0800 2010
commit  247fb4d6ad7e577b62c4e29c03fad5900a9b12b6
tree    29ea07ab3e74b5822b0114f83859f67a3670cbbd
parent  b5356df98423a51e638517d41b267933444972ab
phpcpd /
name age
history
message
directory PHPCPD/ Tue Feb 09 00:53:46 -0800 2010 Show error message when no files are found. [sebastianbergmann]
file README.markdown Sat Jan 09 12:37:46 -0800 2010 Fugbix. [sebastianbergmann]
file package.xml Tue Feb 09 01:06:06 -0800 2010 Prepare release. [sebastianbergmann]
file phpcpd.bat Thu Dec 31 00:03:14 -0800 2009 Bump copyright year. [sebastianbergmann]
file phpcpd.php Thu Dec 31 00:03:14 -0800 2009 Bump copyright year. [sebastianbergmann]
README.markdown

phpcpd

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

The goal of phpcpd is not to replace more sophisticated tools such as phpcs, pdepend, or phpmd, but rather to provide an alternative to them when you just need to get a quick overview of duplicated code in a project.

Requirements

  • The tokenizer extension is required.

Installation

phpcpd should be installed using the PEAR Installer. This installer is the backbone of PEAR, which provides a distribution system for PHP packages, and is shipped with every release of PHP since version 4.3.0.

The PEAR channel (pear.phpunit.de) that is used to distribute phpcpd needs to be registered with the local PEAR environment. Furthermore, a component that phpcpd depends upon is hosted on the eZ Components PEAR channel (components.ez.no).

sb@ubuntu ~ % pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded

sb@ubuntu ~ % pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded

This has to be done only once. Now the PEAR Installer can be used to install packages from the PHPUnit channel:

sb@ubuntu ~ % pear install phpunit/phpcpd
downloading phpcpd-1.3.0.tgz ...
Starting to download phpcpd-1.3.0.tgz (7,809 bytes)
.....done: 7,809 bytes
downloading File_Iterator-1.1.0.tgz ...
Starting to download File_Iterator-1.1.0.tgz (3,181 bytes)
...done: 3,181 bytes
downloading ConsoleTools-1.6.tgz ...
Starting to download ConsoleTools-1.6.tgz (869,925 bytes)
.........................................................
.........................................................
.........................................................
..done: 869,925 bytes
downloading Base-1.8.tgz ...
Starting to download Base-1.8.tgz (236,357 bytes)
...done: 236,357 bytes
install ok: channel://components.ez.no/Base-1.8
install ok: channel://components.ez.no/ConsoleTools-1.6
install ok: channel://pear.phpunit.de/File_Iterator-1.1.0
install ok: channel://pear.phpunit.de/phpcpd-1.3.0

After the installation you can find the phpcpd source files inside your local PEAR directory; the path is usually /usr/lib/php/PHPCPD.

Usage Example

sb@ubuntu ~ % phpcpd /usr/local/src/phpunit/trunk 
phpcpd 1.3.0 by Sebastian Bergmann.

Found 4 exact clones with 131 duplicated lines in 7 files:

  - PHPUnit/Samples/BankAccountDB/BankAccountDBTestMySQL.php:84-128
    PHPUnit/Samples/BankAccountDB/BankAccountDBTest.php:84-128

  - PHPUnit/Tests/Extensions/Database/DataSet/XmlDataSetsTest.php:71-97
    PHPUnit/Tests/Extensions/Database/DataSet/CsvDataSetTest.php:70-96

  - PHPUnit/Tests/Extensions/Database/DataSet/XmlDataSetsTest.php:71-98
    PHPUnit/Tests/Extensions/Database/DataSet/YamlDataSetTest.php:70-97

  - PHPUnit/Extensions/Database/DataSet/AbstractTable.php:156-190
    PHPUnit/Extensions/Database/DataSet/ReplacementTable.php:172-206

0.20% duplicated lines out of 64826 total lines of code.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server