# tasks/ext/PhpCodeSnifferTask.php

A PHP code sniffer task. Checking the style of one or more PHP source files.

Author
  Dirk Thomas
Package
  phing.tasks.ext
Version
  $Id: PhpCodeSnifferTask.php 1330 2011-10-21 13:36:28Z mrook $

## \PhpCodeSnifferTask
jump to top

Package: phing\tasks\ext

A PHP code sniffer task. Checking the style of one or more PHP source files.

Parent(s)
  \Task < \ProjectComponent
Author
  Dirk Thomas
Version
  $Id: PhpCodeSnifferTask.php 1330 2011-10-21 13:36:28Z mrook $

### Properties

`$allowedFileExtensions= 'array('php')'`
Default value `array('php')`Details

Type
  n/a

`$configData= 'array()'`
Default value `array()`Details

Type
  n/a

`\PhingFile $docFile= 'null'`

Holds the outfile for the documentation

Default value `null` Details

Type
  \PhingFile

`string $docGenerator= ''''`

Holds the type of the doc generator

Default value`''`Details

Type
  string

`$encoding= ''iso-8859-1''`
Default value`'iso-8859-1'`Details

Type
  n/a

`$file= ''`
Details

Type
  n/a

`$filesets= 'array()'`
Default value `array()`Details

Type
  n/a

`$format= ''default''`
Default value`'default'`Details

Type
  n/a

`$formatters= 'array()'`
Default value `array()`Details

Type
  n/a

`$haltonerror= 'false'`
Default value `false` Details

Type
  n/a

`$haltonwarning= 'false'`
Default value `false` Details

Type
  n/a

`$ignorePatterns= 'false'`
Default value `false` Details

Type
  n/a

`$noSubdirectories= 'false'`
Default value `false` Details

Type
  n/a

`$reportWidth= '80'`
Default value `80` Details

Type
  n/a

`$showSniffs= 'false'`
Default value `false` Details

Type
  n/a

`$showSources= 'false'`
Default value `false` Details

Type
  n/a

`$showWarnings= 'true'`
Default value `true` Details

Type
  n/a

`$skipVersionCheck= 'false'`
Default value `false` Details

Type
  n/a

`$sniffs= 'array()'`
Default value `array()`Details

Type
  n/a

`$standard= ''Generic''`
Default value`'Generic'`Details

Type
  n/a

`$tabWidth= '0'`
Default value `0` Details

Type
  n/a

`$verbosity= '0'`
Default value `0` Details

Type
  n/a

### Methods

`createConfig( ) : \Parameter`

Creates a config parameter for this task

Returns

Type | Description
--- | ---
\Parameter | The created parameter

`createFileSet( ) : \FileSet`

Nested creator, creates a FileSet for this task

Returns

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

`createFormatter( ) : \CodeSniffer_FormatterElement`

Create object for nested formatter element.

Returns

Type | Description
--- | ---
\CodeSniffer_FormatterElement |

`getDescription( ) : void`

`getLocation( ) : void`

`getOwningTarget( ) : void`

`getProject( ) : void`

`getRegisterSlot( ) : void`

`getRuntimeConfigurableWrapper( ) : void`

`getTaskName( ) : void`

`getTaskType( ) : void`

`init( ) : void`

Load the necessary environment for running PHP_CodeSniffer.

`log( ) : void`

`main( ) : void`

Executes PHP code sniffer against PhingFile or a FileSet

`maybeConfigure( ) : void`

`outputCustomFormat( array $report ) : void`

Outputs the results with a custom format

Parameters

Name | Type | Description
--- | --- | ---
$report | array | Packaged list of all errors in each file

`outputCustomFormatMessages( array $messages, string $type ) : void`

Outputs the messages of a specific type for one file

Parameters

Name | Type | Description
--- | --- | ---
$messages | array |
$type | string |

`perform( ) : void`

`printErrorReport( \PHP_CodeSniffer $phpcs ) : int`

Prints the error report.

Parameters

Name | Type | Description
--- | --- | ---
$phpcs | \PHP_CodeSniffer | The PHP_CodeSniffer object containing the errors.

Returns

Type | Description
--- | ---
int | The number of error and warning messages shown.

`setAllowedFileExtensions( array $extensions ) : void`

Sets the allowed file extensions when using directories instead of specific files

Parameters

Name | Type | Description
--- | --- | ---
$extensions | array |

`setDescription( ) : void`

`setDocFile( \PhingFile $file ) : void`

Sets the outfile for the documentation

Parameters

Name | Type | Description
--- | --- | ---
$file | \PhingFile | The outfile for the doc

`setDocGenerator( string $generator ) : void`

Sets the type of the doc generator

Parameters

Name | Type | Description
--- | --- | ---
$generator | string | HTML or Text

`setEncoding( string $encoding ) : void`

Sets file encoding

Parameters

Name | Type | Description
--- | --- | ---
$encoding | string |

`setFile( \PhingFile $file ) : void`

File to be performed syntax check on

Parameters

Name | Type | Description
--- | --- | ---
$file | \PhingFile |

`setFormat( string $format ) : void`

Sets the output format

Parameters

Name | Type | Description
--- | --- | ---
$format | string |

`setHaltonerror( boolean $value ) : void`

Sets the haltonerror flag

Parameters

Name | Type | Description
--- | --- | ---
$value | boolean |

`setHaltonwarning( boolean $value ) : void`

Sets the haltonwarning flag

Parameters

Name | Type | Description
--- | --- | ---
$value | boolean |

`setIgnorePatterns( $patterns ) : void`

Sets the ignore patterns to skip files when using directories instead of specific files

Parameters

Name | Type | Description
--- | --- | ---
$patterns |  |

`setLocation( ) : void`

`setNoSubdirectories( boolean $subdirectories ) : void`

Sets the flag if subdirectories should be skipped

Parameters

Name | Type | Description
--- | --- | ---
$subdirectories | boolean |

`setOwningTarget( ) : void`

`setProject( ) : void`

`setReportWidth( int $width ) : void`

Sets the width of the report

Parameters

Name | Type | Description
--- | --- | ---
$width | int | How wide the screen reports should be.

`setRuntimeConfigurableWrapper( ) : void`

`setShowSniffs( boolean $show ) : void`

Sets the flag if the used sniffs should be listed

Parameters

Name | Type | Description
--- | --- | ---
$show | boolean |

`setShowSources( boolean $show ) : void`

Sets the flag if sources should be shown

Parameters

Name | Type | Description
--- | --- | ---
$show | boolean | Whether to show sources or not

`setShowWarnings( boolean $show ) : void`

Sets the flag if warnings should be shown

Parameters

Name | Type | Description
--- | --- | ---
$show | boolean |

`setSkipVersionCheck( boolean $value ) : void`

Sets the skipversioncheck flag

Parameters

Name | Type | Description
--- | --- | ---
$value | boolean |

`setSniffs( string $sniffs ) : void`

Sets the sniffs which the standard should be restricted to

Parameters

Name | Type | Description
--- | --- | ---
$sniffs | string |

`setStandard( string $standard ) : void`

Sets the coding standard to test for

Parameters

Name | Type | Description
--- | --- | ---
$standard | string | The coding standard

`setTabWidth( int $width ) : void`

Sets the tab width to replace tabs with spaces

Parameters

Name | Type | Description
--- | --- | ---
$width | int |

`setTaskName( ) : void`

`setTaskType( ) : void`

`setVerbosity( int $level ) : void`

Sets the verbosity level

Parameters

Name | Type | Description
--- | --- | ---
$level | int |

## \PhpCodeSnifferTask_FormatterElement
jump to top

Package: phing\tasks\ext

Parent(s)
  \DataType < \ProjectComponent

### Properties

`string $outfile= '""'`

Output file.

Default value`""`Details

Type
  string

`string $type= '""'`

Type of output to generate

Default value`""`Details

Type
  string

`bool $useFile= 'true'`

Output to file?

Default value `true` Details

Type
  bool

### Methods

`circularReference( ) : void`

`dieOnCircularReference( ) : void`

`getCheckedRef( ) : void`

`getDescription( ) : void`

`getOutfile( ) : void`

`getProject( ) : void`

`getType( ) : void`

`getUseFile( ) : void`

`isReference( ) : void`

`log( ) : void`

`noChildrenAllowed( ) : void`

`parsingComplete( ) : void`

Validate config.

`setDescription( ) : void`

`setOutfile( $outfile ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$outfile |  |

`setProject( ) : void`

`setRefid( ) : void`

`setType( $type ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$type |  |

`setUseFile( $useFile ) : void`

Parameters

Name | Type | Description
--- | --- | ---
$useFile |  |

`tooManyAttributes( ) : void`

Documentation was generated by DocBlox 0.17.1.