Forrest logo
back to the phpcpd tool

phpcpd:tldr:4afce

phpcpd: Exclude a directory from analysis (must be relative to the source).
$ phpcpd --exclude ${path-to-excluded_directory} ${filename_or_directory}
try on your machine

The command phpcpd is used to detect duplicate lines of code in PHP projects. It analyzes PHP files and finds identical or very similar code sections that could be potential candidates for refactoring or consolidation.

The command you provided includes two options:

  1. --exclude ${path-to-excluded_directory}: This option is used to exclude specific directories from the analysis. You need to replace ${path-to-excluded_directory} with the actual path to the directory you want to exclude. This directory will not be analyzed for duplicates.

  2. ${filename_or_directory}: This is the argument that specifies the PHP file or directory to be analyzed for duplicate code. It can be a single PHP file or a directory containing multiple PHP files.

For example, if you want to analyze a directory called "src" for duplicate code, but exclude a directory called "vendor" within it, the command might look like:

phpcpd --exclude src/vendor src

This command will run the phpcpd tool, analyzing all PHP files in the "src" directory, but excluding the "vendor" directory from the analysis.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the phpcpd tool