classes/phing/tasks/ext/phpcpd/PHPCPDTask.php

\PHPCPDTask

Runs PHP Copy & Paste Detector. Checking PHP files for duplicated code.

Refactored original PhpCpdTask provided by Timo Haberkern timo.haberkern@fantastic-bits.de

Extends from
\Task
author
Benjamin Schultz
copyright
2001,2002 THYRELL. All rights reserved
package
phing.tasks.ext.phpcpd
version
$Id: PHPCPDTask.php 1281 2011-08-18 19:23:20Z mrook $

Properties

Propertyprotectedarray  $_allowedFileExtensions= 'array'

List of valid file extensions for analyzed files.

Default valuearrayDetails
Type
array
Propertyprotected\PhingFile  $_file= 'null'

A php source code filename or directory

Default valuenullDetails
Type
\PhingFile
Propertyprotected\array<FileSet>  $_filesets= 'array'

All fileset objects assigned to this task

Default valuearrayDetails
Type
\array<FileSet>
Propertyprotectedstring  $_format= 'default'

The format for the report

Default valuedefaultDetails
Type
string
Propertyprotected\array<PHPCPDFormatterElement>  $_formatters= 'array'

Formatter elements.

Default valuearrayDetails
Type
\array<PHPCPDFormatterElement>
Propertyprotectedarray  $_ignorePatterns= 'array'

List of exclude directory patterns.

Default valuearrayDetails
Type
array
Propertyprotectedinteger  $_minLines= '5'

Minimum number of identical lines.

Default value5Details
Type
integer
Propertyprotectedinteger  $_minTokens= '70'

Minimum number of identical tokens.

Default value70Details
Type
integer

Methods

methodpublic  createFileSet( ) : \FileSet
Nested creator, adds a set of files (nested fileset attribute).
Returns
Type Description
\FileSet
methodpublic  createFormatter( ) : \PHPCPDFormatterElement
Create object for nested formatter element.
Returns
Type Description
\PHPCPDFormatterElement
methodpublic  init( ) :
Load the necessary environment for running PHPCPD.
Details
throws
- if the phpcpd classes can't be loaded.
methodpublic  main( ) : void
Executes PHPCPD against PhingFile or a FileSet
methodpublic  setAllowedFileExtensions( string $fileExtensions ) : void
Sets a list of filename extensions for valid php source code files.
Parameters
Name Type Description
$fileExtensions string List of valid file extensions.
methodpublic  setFile( \PhingFile $file ) : void
Set the input source file or directory.
Parameters
Name Type Description
$file \PhingFile The input source file or directory.
methodpublic  setFormat( string $format ) :
Sets the output format
Parameters
Name Type Description
$format string Format of the report
methodpublic  setIgnorePatterns( string $ignorePatterns ) : void
Sets a list of ignore patterns that is used to exclude directories from the source analysis.
Parameters
Name Type Description
$ignorePatterns string List of ignore patterns.
methodpublic  setMinLines( integer $minLines ) : void
Sets the minimum number of identical lines (default: 5).
Parameters
Name Type Description
$minLines integer Minimum number of identical lines
methodpublic  setMinTokens( integer $minTokens ) :
Sets the minimum number of identical tokens (default: 70).
Parameters
Name Type Description
$minTokens integer Minimum number of identical tokens
methodpublic  setMinimumPriority( integer $minimumPriority ) : void
Sets the minimum rule priority.
Parameters
Name Type Description
$minimumPriority integer Minimum rule priority.
methodprotected  validateFormatters( ) : void
Validates the available formatters
Details
throws
Documentation was generated by DocBlox 0.13.1.