PHP Class PHPMD\TextUI\CommandLineOptions

Author: Manuel Pichler ([email protected])
Exibir arquivo Open project: phpmd/phpmd Class Usage Examples

Protected Properties

Property Type Description
$availableRuleSets array(string) List of available rule-sets.
$coverageReport string File name of a PHPUnit code coverage report.
$extensions string A string of comma-separated extensions for valid php source code filenames.
$ignore string A string of comma-separated pattern that is used to exclude directories.
$ignoreViolationsOnExit boolean Should PHPMD exit without error code even if violation is found?
$inputPath string A php source code filename or directory.
$minimumPriority integer The minimum rule priority.
$reportFile string An optional filename for the generated report.
$reportFiles array Additional report files.
$reportFormat string The specified report format.
$ruleSets string A ruleset filename or a comma-separated string of ruleset filenames.
$strict boolean Should PHPMD run in strict mode?
$version boolean Should the shell show the current phpmd version?

Public Methods

Method Description
__construct ( array $args, array $availableRuleSets = [] ) Constructs a new command line options instance.
createRenderer ( string $reportFormat = null ) : PHPMD\AbstractRenderer Creates a report renderer instance based on the user's command line argument.
getCoverageReport ( ) : string Returns the file name of a supplied code coverage report or NULL if the user has not supplied the --coverage option.
getExtensions ( ) : string Returns a string of comma-separated extensions for valid php source code filenames or null when this argument was not set.
getIgnore ( ) : string Returns string of comma-separated pattern that is used to exclude directories or null when this argument was not set.
getInputPath ( ) : string Returns a php source code filename or directory.
getMinimumPriority ( ) : integer Returns the minimum rule priority.
getReportFile ( ) : string Returns the output filename for a generated report or null when the report should be displayed in STDOUT.
getReportFiles ( ) : array Returns a hash with report files specified for different renderers. The key represents the report format and the value the report file location.
getReportFormat ( ) : string Returns the specified report format.
getRuleSets ( ) : string Returns a ruleset filename or a comma-separated string of ruleset
hasStrict ( ) : boolean Was the --strict option passed to PHPMD's command line interface?
hasVersion ( ) : boolean Was the --version passed to PHPMD's command line interface?
ignoreViolationsOnExit ( ) : boolean Was the --ignore-violations-on-exit passed to PHPMD's command line interface?
usage ( ) : string Returns usage information for the PHPMD command line interface.

Protected Methods

Method Description
createCustomRenderer ( ) : PHPMD\AbstractRenderer
createHtmlRenderer ( ) : PHPMD\Renderer\HTMLRenderer
createTextRenderer ( ) : XMLRenderer
createXmlRenderer ( ) : XMLRenderer
logDeprecated ( string $deprecatedName, string $newName ) : void Logs a deprecated option to the current user interface.
readInputFile ( string $inputFile ) : string This method takes the given input file, reads the newline separated paths from that file and creates a comma separated string of the file paths. If the given $inputFile not exists, this method will throw an exception.

Method Details

__construct() public method

Constructs a new command line options instance.
public __construct ( array $args, array $availableRuleSets = [] )
$args array
$availableRuleSets array

createCustomRenderer() protected method

protected createCustomRenderer ( ) : PHPMD\AbstractRenderer
return PHPMD\AbstractRenderer

createHtmlRenderer() protected method

protected createHtmlRenderer ( ) : PHPMD\Renderer\HTMLRenderer
return PHPMD\Renderer\HTMLRenderer

createRenderer() public method

Valid renderers are:
  • xml
  • html
  • text
public createRenderer ( string $reportFormat = null ) : PHPMD\AbstractRenderer
$reportFormat string
return PHPMD\AbstractRenderer

createTextRenderer() protected method

protected createTextRenderer ( ) : XMLRenderer
return PHPMD\Renderer\XMLRenderer

createXmlRenderer() protected method

protected createXmlRenderer ( ) : XMLRenderer
return PHPMD\Renderer\XMLRenderer

getCoverageReport() public method

Returns the file name of a supplied code coverage report or NULL if the user has not supplied the --coverage option.
public getCoverageReport ( ) : string
return string

getExtensions() public method

Returns a string of comma-separated extensions for valid php source code filenames or null when this argument was not set.
public getExtensions ( ) : string
return string

getIgnore() public method

Returns string of comma-separated pattern that is used to exclude directories or null when this argument was not set.
public getIgnore ( ) : string
return string

getInputPath() public method

Returns a php source code filename or directory.
public getInputPath ( ) : string
return string

getMinimumPriority() public method

Returns the minimum rule priority.
public getMinimumPriority ( ) : integer
return integer

getReportFile() public method

Returns the output filename for a generated report or null when the report should be displayed in STDOUT.
public getReportFile ( ) : string
return string

getReportFiles() public method

Returns a hash with report files specified for different renderers. The key represents the report format and the value the report file location.
public getReportFiles ( ) : array
return array

getReportFormat() public method

Returns the specified report format.
public getReportFormat ( ) : string
return string

getRuleSets() public method

Returns a ruleset filename or a comma-separated string of ruleset
public getRuleSets ( ) : string
return string

hasStrict() public method

Was the --strict option passed to PHPMD's command line interface?
Since: 1.2.0
public hasStrict ( ) : boolean
return boolean

hasVersion() public method

Was the --version passed to PHPMD's command line interface?
public hasVersion ( ) : boolean
return boolean

ignoreViolationsOnExit() public method

Was the --ignore-violations-on-exit passed to PHPMD's command line interface?
public ignoreViolationsOnExit ( ) : boolean
return boolean

logDeprecated() protected method

Logs a deprecated option to the current user interface.
protected logDeprecated ( string $deprecatedName, string $newName ) : void
$deprecatedName string
$newName string
return void

readInputFile() protected method

This method takes the given input file, reads the newline separated paths from that file and creates a comma separated string of the file paths. If the given $inputFile not exists, this method will throw an exception.
Since: 1.1.0
protected readInputFile ( string $inputFile ) : string
$inputFile string Specified input file name.
return string

usage() public method

Returns usage information for the PHPMD command line interface.
public usage ( ) : string
return string

Property Details

$availableRuleSets protected_oe property

List of available rule-sets.
protected array(string) $availableRuleSets
return array(string)

$coverageReport protected_oe property

File name of a PHPUnit code coverage report.
protected string $coverageReport
return string

$extensions protected_oe property

A string of comma-separated extensions for valid php source code filenames.
protected string $extensions
return string

$ignore protected_oe property

A string of comma-separated pattern that is used to exclude directories.
protected string $ignore
return string

$ignoreViolationsOnExit protected_oe property

Should PHPMD exit without error code even if violation is found?
protected bool $ignoreViolationsOnExit
return boolean

$inputPath protected_oe property

A php source code filename or directory.
protected string $inputPath
return string

$minimumPriority protected_oe property

The minimum rule priority.
protected int $minimumPriority
return integer

$reportFile protected_oe property

An optional filename for the generated report.
protected string $reportFile
return string

$reportFiles protected_oe property

Additional report files.
protected array $reportFiles
return array

$reportFormat protected_oe property

The specified report format.
protected string $reportFormat
return string

$ruleSets protected_oe property

A ruleset filename or a comma-separated string of ruleset filenames.
protected string $ruleSets
return string

$strict protected_oe property

Should PHPMD run in strict mode?
Since: 1.2.0
protected bool $strict
return boolean

$version protected_oe property

Should the shell show the current phpmd version?
protected bool $version
return boolean