2018-11-26 18:10:58 +00:00
|
|
|
# phpcpd
|
|
|
|
|
|
|
|
> A copy and paste detector for PHP code.
|
2019-05-29 14:53:47 +01:00
|
|
|
> More information: <https://github.com/sebastianbergmann/phpcpd>.
|
2018-11-26 18:10:58 +00:00
|
|
|
|
2022-06-27 11:23:12 +01:00
|
|
|
- Analyze duplicated code for a specific file or directory:
|
2018-11-26 18:10:58 +00:00
|
|
|
|
|
|
|
`phpcpd {{path/to/file_or_directory}}`
|
|
|
|
|
2022-06-27 11:23:12 +01:00
|
|
|
- Analyze using fuzzy matching for variable names:
|
2018-11-26 18:10:58 +00:00
|
|
|
|
|
|
|
`phpcpd --fuzzy {{path/to/file_or_directory}}`
|
|
|
|
|
|
|
|
- Specify a minimum number of identical lines (defaults to 5):
|
|
|
|
|
|
|
|
`phpcpd --min-lines {{number_of_lines}} {{path/to/file_or_directory}}`
|
|
|
|
|
|
|
|
- Specify a minimum number of identical tokens (defaults to 70):
|
|
|
|
|
|
|
|
`phpcpd --min-tokens {{number_of_tokens}} {{path/to/file_or_directory}}`
|
|
|
|
|
|
|
|
- Exclude a directory from analysis (must be relative to the source):
|
|
|
|
|
|
|
|
`phpcpd --exclude {{path/to/excluded_directory}} {{path/to/file_or_directory}}`
|
|
|
|
|
|
|
|
- Output the results to a PHP-CPD XML file:
|
|
|
|
|
|
|
|
`phpcpd --log-pmd {{path/to/log_file}} {{path/to/file_or_directory}}`
|