# tasks/ext/phpcpd/PHPCPDTask.php

$Id: PHPCPDTask.php 1340 2011-10-31 09:40:00Z mrook $

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals and is licensed under the LGPL. For more information please see http://phing.info.

## \PHPCPDTask
jump to top

Package: phing\tasks\ext\phpcpd

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

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

Parent(s)
  \Task < \ProjectComponent
Author
  Benjamin Schultz
Version
  $Id: PHPCPDTask.php 1340 2011-10-31 09:40:00Z mrook $

### Properties

`array $_allowedFileExtensions= 'array('php')'`

List of valid file extensions for analyzed files.

Default value `array('php')`Details

Type
  array

`\PhingFile $_file= 'null'`

A php source code filename or directory

Default value `null` Details

Type
  \PhingFile

`\array<FileSet> $_filesets= 'array()'`

All fileset objects assigned to this task

Default value `array()`Details

Type
  \array<FileSet>

`string $_format= ''default''`

The format for the report

Default value`'default'`Details

Type
  string

`\array<PHPCPDFormatterElement> $_formatters= 'array()'`

Formatter elements.

Default value `array()`Details

Type
  \array<PHPCPDFormatterElement>

`array $_ignorePatterns= 'array('.git''`

List of exclude directory patterns.

Default value `array('.git'`Details

Type
  array

`integer $_minLines= '5'`

Minimum number of identical lines.

Default value `5` Details

Type
  integer

`integer $_minTokens= '70'`

Minimum number of identical tokens.

Default value `70` Details

Type
  integer

### Methods

`createFileSet( ) : \FileSet`

Nested creator, adds a set of files (nested fileset attribute).

Returns

Type | Description
--- | ---
\FileSet | The created fileset object

`createFormatter( ) : \PHPCPDFormatterElement`

Create object for nested formatter element.

Returns

Type | Description
--- | ---
\PHPCPDFormatterElement |

`getDescription( ) : void`

`getLocation( ) : void`

`getOwningTarget( ) : void`

`getProject( ) : void`

`getRegisterSlot( ) : void`

`getRuntimeConfigurableWrapper( ) : void`

`getTaskName( ) : void`

`getTaskType( ) : void`

`init( ) : void`

Load the necessary environment for running PHPCPD.

Throws

Exception | Description
--- | ---
\BuildException | - if the phpcpd classes can't be loaded.

`log( ) : void`

`main( ) : void`

Executes PHPCPD against PhingFile or a FileSet

`maybeConfigure( ) : void`

`perform( ) : void`

`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.

`setDescription( ) : void`

`setFile( \PhingFile $file ) : void`

Set the input source file or directory.

Parameters

Name | Type | Description
--- | --- | ---
$file | \PhingFile | The input source file or directory.

`setFormat( string $format ) : void`

Sets the output format

Parameters

Name | Type | Description
--- | --- | ---
$format | string | Format of the report

`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.

`setLocation( ) : void`

`setMinLines( integer $minLines ) : void`

Sets the minimum number of identical lines (default: 5).

Parameters

Name | Type | Description
--- | --- | ---
$minLines | integer | Minimum number of identical lines

`setMinTokens( integer $minTokens ) : void`

Sets the minimum number of identical tokens (default: 70).

Parameters

Name | Type | Description
--- | --- | ---
$minTokens | integer | Minimum number of identical tokens

`setMinimumPriority( integer $minimumPriority ) : void`

Sets the minimum rule priority.

Parameters

Name | Type | Description
--- | --- | ---
$minimumPriority | integer | Minimum rule priority.

`setOwningTarget( ) : void`

`setProject( ) : void`

`setRuntimeConfigurableWrapper( ) : void`

`setTaskName( ) : void`

`setTaskType( ) : void`

`validateFormatters( ) : void`

Validates the available formatters

Throws

Exception | Description
--- | ---
\BuildException |

Documentation was generated by DocBlox 0.17.1.