# classes/phing/tasks/ext/phpmd/PHPMDTask.php

## \PHPMDTask
jump to top

Runs PHP Mess Detector. Checking PHP files for several potential problems based on rulesets.

Use {@link Project#createTask} to register a new Task.

Extends from
  \Task
author
  Benjamin Schultz
copyright
  2001,2002 THYRELL. All rights reserved
package
  phing.tasks.ext.phpmd
since
  2.4.1
version
  $Id: PHPMDTask.php 1223 2011-07-15 19:27:56Z mrook $

### Properties

`array $allowedFileExtensions= 'array'`

List of valid file extensions for analyzed files.

Default value `array` 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= 'text'`

The format for the report

Default value `text` Details

Type
  string

`\array<PHPMDFormatterElement> $formatters= 'array'`

Formatter elements.

Default value `array` Details

Type
  \array<PHPMDFormatterElement>

`array $ignorePatterns= 'array'`

List of exclude directory patterns.

Default value `array` Details

Type
  array

`integer $minimumPriority= '5'`

The minimum priority for rules to load.

Default value `5` Details

Type
  integer

`string $rulesets= 'codesize,unusedcode'`

The rule-set filenames or identifier.

Default value `codesize,unusedcode` Details

Type
  string

### Methods

`createFileSet( ) : \FileSet`
Nested creator, adds a set of files (nested fileset attribute).
Returns

Type | Description
--- | ---
\FileSet |

`createFormatter( ) : \PHPMDFormatterElement`
Create object for nested formatter element.
Returns

Type | Description
--- | ---
\PHPMDFormatterElement |

`init( ) :`
Load the necessary environment for running PHPMD.
Details

throws
  - if the phpmd classes can't be loaded.

`main( ) : void`
Executes PHPMD against PhingFile or a FileSet
`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 without leading dot.

`setFile( \PhingFile $file ) : void`
Set the input source file or directory.
Parameters

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

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

`setMinimumPriority( integer $minimumPriority ) : void`
Sets the minimum rule priority.
Parameters

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

`setRulesets( string $ruleSetFileNames ) : void`
Sets the rule-sets.
Parameters

Name | Type | Description
--- | --- | ---
$ruleSetFileNames | string | Comma-separated string of rule-set filenames or identifier.

Documentation was generated by DocBlox 0.13.1.