apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: Ruleset

Source Location: /PHP_CodeSniffer-3.1.1/src/Ruleset.php

Class Overview


Stores the rules used to check and fix files.


Author(s):

Copyright:

  • 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 17]
Stores the rules used to check and fix files.

A ruleset object directly maps to a ruleset XML file.



[ Top ]


Class Variables

$ignorePatterns = array()

[line 51]

A list of regular expressions used to ignore specific sniffs for files and folders.

Is also used to set global exclude patterns. The key is the regular expression and the value is the type of ignore pattern (absolute or relative).

  • Var: string>
  • Access: public

Type:   array


[ Top ]

$includePatterns = array()

[line 62]

A list of regular expressions used to include specific sniffs for files and folders.

The key is the sniff code and the value is an array with the key being a regular expression and the value is the type of ignore pattern (absolute or relative).

  • Var: array<string, string>>
  • Access: public

Type:   array


[ Top ]

$name =  ''

[line 33]

The name of the coding standard being used.

If a top-level standard includes other standards, or sniffs from other standards, only the name of the top-level standard will be stored in here.

If multiple top-level standards are being loaded into a single ruleset object, this will store a comma separated list of the top-level standard names.

  • Access: public

Type:   string


[ Top ]

$paths = array()

[line 40]

A list of file paths for the ruleset files being used.
  • Access: public

Type:   string[]


[ Top ]

$ruleset = array()

[line 102]

An array of rules from the ruleset.xml file.

It may be empty, indicating that the ruleset does not override any of the default sniff settings.

  • Var: mixed>
  • Access: public

Type:   array


[ Top ]

$rulesetDirs = array()

[line 109]

The directories that the processed rulesets are in.
  • Access: protected

Type:   string[]


[ Top ]

$sniffCodes = array()

[line 82]

A mapping of sniff codes to fully qualified class names.

The key is the sniff code and the value is the fully qualified name of the sniff class.

  • Var: string>
  • Access: public

Type:   array


[ Top ]

$sniffs = array()

[line 72]

An array of sniff objects that are being used to check files.

The key is the fully qualified name of the sniff class and the value is the sniff object.

  • Var: \PHP_CodeSniffer\Sniff>
  • Access: public

Type:   array


[ Top ]

$tokenListeners = array()

[line 92]

An array of token types and the sniffs that are listening for them.

The key is the token name being listened for and the value is the sniff object.

  • Var: \PHP_CodeSniffer\Sniff>
  • Access: public

Type:   array


[ Top ]



Method Detail

__construct (Constructor)   [line 126]

void __construct( Config $config)

Initialise the ruleset that the run will use.
  • Access: public

Parameters:

\PHP_CodeSniffer\Config   $config   —  The config data for the run.

[ Top ]

explain   [line 235]

void explain( )

Prints a report showing the sniffs contained in a standard.
  • Access: public

[ Top ]

getIgnorePatterns   [line 1267]

array getIgnorePatterns( [string $listener = null])

Gets the array of ignore patterns.

Optionally takes a listener to get ignore patterns specified for that sniff only.

  • Access: public

Parameters:

string   $listener   —  The listener to get patterns for. If NULL, all patterns are returned.

[ Top ]

getIncludePatterns   [line 1293]

array getIncludePatterns( [string $listener = null])

Gets the array of include patterns.

Optionally takes a listener to get include patterns specified for that sniff only.

  • Access: public

Parameters:

string   $listener   —  The listener to get patterns for. If NULL, all patterns are returned.

[ Top ]

populateTokenListeners   [line 1146]

void populateTokenListeners( )

Populates the array of PHP_CodeSniffer_Sniff's for this file.
  • Throws: RuntimeException If sniff registration fails.
  • Access: public

[ Top ]

processRuleset   [line 308]

string[] processRuleset( string $rulesetPath, [int $depth = 0])

Processes a single ruleset and returns a list of the sniffs it represents.

Rules founds within the ruleset are processed immediately, but sniff classes are not registered by this method.

  • Throws: RuntimeException If the ruleset path is invalid.
  • Access: public

Parameters:

string   $rulesetPath   —  The path to a ruleset XML file.
int   $depth   —  How many nested processing steps we are in. This is only used for debug output.

[ Top ]

registerSniffs   [line 1086]

void registerSniffs( array $files, array $restrictions, array $exclusions)

Loads and stores sniffs objects used for sniffing files.
  • Access: public

Parameters:

array   $files   —  Paths to the sniff files to register.
array   $restrictions   —  The sniff class names to restrict the allowed listeners to.
array   $exclusions   —  The sniff class names to exclude from the listeners list.

[ Top ]

setSniffProperty   [line 1232]

void setSniffProperty( string $sniffClass, string $name, string $value)

Set a single property for a sniff.
  • Access: public

Parameters:

string   $sniffClass   —  The class name of the sniff.
string   $name   —  The name of the property to change.
string   $value   —  The new value of the property.

[ Top ]


Documentation generated on Mon, 16 Oct 2017 23:00:43 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.