PHP Class PHPMD\RuleSetFactory

Author: Manuel Pichler ([email protected])
Show file Open project: horde/horde Class Usage Examples

Public Methods

Method Description
__construct ( ) Constructs a new default rule-set factory instance.
createRuleSets ( string $ruleSetFileNames ) : PHPMD\RuleSet[] Creates an array of rule-set instances for the given argument.
createSingleRuleSet ( string $ruleSetOrFileName ) : PHPMD\RuleSet Creates a single rule-set instance for the given filename or identifier.
getIgnorePattern ( $fileName ) : array Returns an array of path exclude patterns in format described at
listAvailableRuleSets ( ) : array(string) Lists available rule-set identifiers.
setMinimumPriority ( integer $minimumPriority ) : void Sets the minimum priority that a rule must have.
setStrict ( ) : void Activates the strict mode for all rule sets.

Private Methods

Method Description
addProperty ( phpmd\Rule $rule, SimpleXMLElement $node ) : void Adds an additional property to the given $rule instance.
createRuleSetFileName ( string $ruleSetOrFileName ) : string This method creates the filename for a rule-set identifier or it returns the input when it is already a filename.
getPropertyValue ( SimpleXMLElement $propertyNode ) : string Returns the value of a property node. This value can be expressed in two different notations. First version is an attribute named value and the second valid notation is a child element named value that contains the value as character data.
isIncluded ( phpmd\Rule $rule, SimpleXMLElement $ruleSetNode ) : boolean Checks if the given rule is included/not excluded by the given rule-set reference node.
listRuleSetsInDirectory ( string $directory ) : array(string) Lists available rule-set identifiers in given directory.
parsePropertiesNode ( phpmd\Rule $rule, SimpleXMLElement $propertiesNode ) : void This method parses a xml properties structure and adds all found properties to the given $rule object.
parseRuleNode ( phpmd\RuleSet $ruleSet, SimpleXMLElement $node ) : void This method parses a single rule xml node. Bases on the structure of the xml node this method delegates the parsing process to another method in this class.
parseRuleReferenceNode ( phpmd\RuleSet $ruleSet, SimpleXMLElement $ruleNode ) : void This method parses a single rule that was included from a different rule-set.
parseRuleSetNode ( string $fileName ) : PHPMD\RuleSet This method parses the rule-set definition in the given file.
parseRuleSetReference ( SimpleXMLElement $ruleSetNode ) : PHPMD\RuleSet Parses a rule-set xml file referenced by the given rule-set xml element.
parseRuleSetReferenceNode ( phpmd\RuleSet $ruleSet, SimpleXMLElement $ruleSetNode ) : void This method parses a complete rule set that was includes a reference in the currently parsed ruleset.
parseSingleRuleNode ( phpmd\RuleSet $ruleSet, SimpleXMLElement $ruleNode ) : void This method will create a single rule instance and add it to the given {@link \PHPMD\RuleSet} object.

Method Details

__construct() public method

Constructs a new default rule-set factory instance.
public __construct ( )

createRuleSets() public method

Creates an array of rule-set instances for the given argument.
public createRuleSets ( string $ruleSetFileNames ) : PHPMD\RuleSet[]
$ruleSetFileNames string Comma-separated string of rule-set filenames or identifier.
return PHPMD\RuleSet[]

createSingleRuleSet() public method

Creates a single rule-set instance for the given filename or identifier.
public createSingleRuleSet ( string $ruleSetOrFileName ) : PHPMD\RuleSet
$ruleSetOrFileName string The rule-set filename or identifier.
return PHPMD\RuleSet

getIgnorePattern() public method

http://pmd.sourceforge.net/pmd-5.0.4/howtomakearuleset.html#Excluding_files_from_a_ruleset
public getIgnorePattern ( $fileName ) : array
$fileName The filename of a rule-set definition.
return array

listAvailableRuleSets() public method

Lists available rule-set identifiers.
public listAvailableRuleSets ( ) : array(string)
return array(string)

setMinimumPriority() public method

Sets the minimum priority that a rule must have.
public setMinimumPriority ( integer $minimumPriority ) : void
$minimumPriority integer The minimum priority value.
return void

setStrict() public method

Activates the strict mode for all rule sets.
Since: 1.2.0
public setStrict ( ) : void
return void