Class: PHP_CodeSniffer
Source Location: /PHP_CodeSniffer-1.3.4/CodeSniffer.php
PHP_CodeSniffer tokenises PHP code and detects violations of a defined set of coding standards.
Author(s):
Version:
- Release: @package_version@
Copyright:
- 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
__construct (Constructor) [line 185]
PHP_CodeSniffer __construct(
[int
$verbosity = 0], [int
$tabWidth = 0], [string
$encoding = 'iso-8859-1'], [bool
$interactive = false])
|
|
Constructs a PHP_CodeSniffer object.
Parameters:
__destruct (Destructor) [line 240]
Destructs a PHP_CodeSniffer object. Restores the current working directory to what it was before we started our run.
addFile [line 375]
Adds a file to the list of checked files. Checked files are used to generate error reports after the run.
Parameters:
autoload [line 254]
void autoload(
string
$className)
|
|
Autoload static method for loading classes and interfaces.
Parameters:
generateDocs [line 1384]
void generateDocs(
string
$standard, [
$sniffs = array()], [string
$generator = 'Text'])
|
|
Generates documentation for a coding standard.
Parameters:
getAllConfigData [line 2000]
string getAllConfigData(
)
|
|
Get all config data in an array.
getConfigData [line 1916]
string getConfigData(
string
$key)
|
|
Get a single config value. Config data is stored in the data dir, in a file called CodeSniffer.conf. It is a simple PHP array.
Parameters:
getFiles [line 1403]
array(PHP_CodeSniffer_File) getFiles(
)
|
|
Returns the PHP_CodeSniffer file objects.
getFilesErrors [line 1357]
Gives collected violations for reports.
getFilesToProcess [line 1035]
array getFilesToProcess(
string
$paths, [boolean
$local = false])
|
|
Get a list of files that will be processed. If passed directories, this method will find all files within them. The method will also perform file extension and ignore pattern filtering.
Parameters:
getIgnorePatterns [line 337]
array getIgnorePatterns(
[string
$listener = null])
|
|
Gets the array of ignore patterns. Optionally takes a listener to get ignore patterns specified for that sniff only.
Parameters:
getInstalledStandards [line 1830]
array getInstalledStandards(
[boolean
$includeGeneric = false], [string
$standardsDir = ''])
|
|
Get a list of all coding standards installed. Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a Sniffs subdirectory.
Parameters:
getSniffFiles [line 707]
array getSniffFiles(
string
$dir, [string
$standard = null])
|
|
Return a list of sniffs that a coding standard has defined. Sniffs are found by recursing the standard directory and also by asking the standard for included sniffs.
Parameters:
getSniffs [line 1415]
array(PHP_CodeSniffer_Sniff) getSniffs(
)
|
|
Gets the array of PHP_CodeSniffer_Sniff's.
getTokenSniffs [line 1427]
array() getTokenSniffs(
)
|
|
Gets the array of PHP_CodeSniffer_Sniff's indexed by token type.
isCamelCaps [line 1647]
boolean isCamelCaps(
string
$string, [boolean
$classFormat = false], [boolean
$public = true], [boolean
$strict = true])
|
|
Returns true if the specified string is in the camel caps format.
Parameters:
isInstalledStandard [line 1876]
boolean isInstalledStandard(
string
$standard)
|
|
Determine if a standard is installed. Coding standards are directories located in the CodeSniffer/Standards directory. Valid coding standards include a Sniffs subdirectory.
Parameters:
isUnderscoreName [line 1712]
boolean isUnderscoreName(
string
$string)
|
|
Returns true if the specified string is in the underscore caps format.
Parameters:
populateCustomRules [line 882]
void populateCustomRules(
[string
$standard = null])
|
|
Sets installed sniffs in the coding standard being used.
Parameters:
populateTokenListeners [line 968]
void populateTokenListeners(
)
|
|
Populates the array of PHP_CodeSniffer_Sniff's for this file.
process [line 397]
void process(
string|array
$files, string
$standard, [
$sniffs = array()], [boolean
$local = false])
|
|
Processes the files/directories that PHP_CodeSniffer was constructed with.
Parameters:
processFile [line 1168]
Run the code sniffs over a single given file. Processes the file and runs the PHP_CodeSniffer sniffs to verify that it conforms with the standard. Returns the processed file object, or NULL if no file was processed due to error.
Parameters:
processMulti [line 551]
Processes multi-file sniffs.
resolveSimpleToken [line 1531]
array resolveSimpleToken(
string
$token)
|
|
Converts simple tokens into a format that conforms to complex tokens produced by token_get_all(). Simple tokens are tokens that are not in array form when produced from token_get_all().
Parameters:
resolveTstringToken [line 1488]
array resolveTstringToken(
$token)
|
|
Converts T_STRING tokens into more usable token names. The token should be produced using the token_get_all() function. Currently, not all T_STRING tokens are converted.
Parameters:
setAllowedFileExtensions [line 294]
void setAllowedFileExtensions(
$extensions)
|
|
Sets an array of file extensions that we will allow checking of. If the extension is one of the defaults, a specific tokenizer will be used. Otherwise, the PHP tokenizer will be used for all extensions passed.
Parameters:
setCli [line 359]
void setCli(
object
$cli)
|
|
Sets the internal CLI object.
Parameters:
setConfigData [line 1951]
boolean setConfigData(
string
$key, string|null
$value, [boolean
$temp = false])
|
|
Set a single config value. Config data is stored in the data dir, in a file called CodeSniffer.conf. It is a simple PHP array.
Parameters:
setIgnorePatterns [line 319]
void setIgnorePatterns(
$patterns)
|
|
Sets an array of ignore patterns that we use to skip files and folders. Patterns are not case sensitive.
Parameters:
setTokenListeners [line 585]
void setTokenListeners(
string
$standard, [
$sniffs = array()])
|
|
Sets installed sniffs in the coding standard being used. Traverses the standard directory for classes that implement the PHP_CodeSniffer_Sniff interface asks them to register. Each of the sniff's class names must be exact as the basename of the sniff file. If the standard is a file, will skip transversal and just load sniffs from the file.
Parameters:
shouldIgnoreFile [line 1129]
bool shouldIgnoreFile(
string
$path)
|
|
Checks filtering rules to see if a file should be ignored.
Parameters:
shouldProcessFile [line 1087]
bool shouldProcessFile(
string
$path)
|
|
Checks filtering rules to see if a file should be checked. Checks both file extension filters and path ignore filters.
Parameters:
standardiseToken [line 1445]
array standardiseToken(
string|array
$token)
|
|
Takes a token produced from
and produces a more uniform token. Note that this method also resolves T_STRING tokens into more descrete types, therefore there is no need to call resolveTstringToken()
Parameters:
suggestType [line 1753]
string suggestType(
string
$varType)
|
|
Returns a valid variable type for param/var tag. If type is not one of the standard type, it must be a custom type. Returns the correct type name suggestion if type name is invalid.
Parameters:
Documentation generated on Thu, 17 May 2012 05:00:27 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|
|