News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sameer Borate's Blog:
Detecting duplicate code in PHP files
April 08, 2009 @ 11:16:17

On his blog today Sameer looks at a method for finding duplicate code in your applications with the help of PHPCPD.

Duplicated code in projects is a frequent thing and also the one ripe for factoring out in a new class or function. Cut/Paste coding is a common development practice among programmers, a lot of which can lead to code size increase and maintenance nightmares. PHPCPD (php copy paste detector) is a PEAR tool that makes it easier to detect duplicate code in php projects. Below is a short tutorial on the PHPCPD package.

You can either install the tool via a PEAR channel or directly from the github site. Once its downloaded and extracted you can immediately run it on the subdirectory of your choice. He also includes a more extended example - a search on a minimum of 5 lines of 70 tokens found to trip the filter in finding cloned functionality.

0 comments voice your opinion now!
phpcpd pear channel install tutorial copy paste detector


blog comments powered by Disqus

Similar Posts

PHPBuilder.com: 10 Easy Solutions for PHP String Manipulation

Sudheer Satyanarayana's Blog: XML RPC Client Using PHP PEAR - A Real World Example: Ping Technorati

Jason Houle's Blog: Zend Framework: The Dijit Editor

Greg Beaver's Blog: problem with PHP_Archive-based phars tracked to odd unpack() bug

Zend Developer Zone: Creating Scalable Vector Graphs with PHP


Community Events

Don't see your event here?
Let us know!


extension introduction voicesoftheelephpant framework php7 podcast library api version series release laravel interview list unittest community example laravel5 language opinion

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework