Class: PHP_CodeSniffer
Source Location: /PHP_CodeSniffer-1.2.0/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 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
Inherited Variables
|
Inherited Methods
|
Class Details
Class Variables
Method Detail
__construct (Constructor) [line 163]
PHP_CodeSniffer __construct(
[int
$verbosity = 0], [int
$tabWidth = 0])
|
|
Constructs a PHP_CodeSniffer object.
Parameters:
__destruct (Destructor) [line 189]
Destructs a PHP_CodeSniffer object. Restores the current working directory to what it was before we started our run.
addFile [line 279]
Adds a file to the list of checked files. Checked files are used to generate error reports after the run.
Parameters:
autoload [line 203]
void autoload(
string
$className)
|
|
Autoload static method for loading classes and interfaces.
Parameters:
generateDocs [line 1406]
void generateDocs(
string
$standard, [
$sniffs = array()], [string
$generator = 'Text'])
|
|
Generates documentation for a coding standard.
Parameters:
getAllConfigData [line 2001]
string getAllConfigData(
)
|
|
Get all config data in an array.
getConfigData [line 1917]
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 1423]
array(PHP_CodeSniffer_File) getFiles(
)
|
|
Returns the PHP_CodeSniffer file objects.
getInstalledStandards [line 1843]
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 515]
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 1435]
array(PHP_CodeSniffer_Sniff) getSniffs(
)
|
|
Gets the array of PHP_CodeSniffer_Sniff's.
getTokenListeners [line 381]
array getTokenListeners(
string
$standard, [
$sniffs = array()])
|
|
Gets 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. Returns an array of sniff class names.
Parameters:
getTokenSniffs [line 1447]
array() getTokenSniffs(
)
|
|
Gets the array of PHP_CodeSniffer_Sniff's indexed by token type.
isCamelCaps [line 1659]
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 1889]
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 1729]
boolean isUnderscoreName(
string
$string)
|
|
Returns true if the specified string is in the underscore caps format.
Parameters:
makeFriendlyName [line 1349]
string makeFriendlyName(
string
$name)
|
|
Converts a camel caps name into a readable string.
Parameters:
populateTokenListeners [line 471]
void populateTokenListeners(
)
|
|
Populates the array of PHP_CodeSniffer_Sniff's for this file.
prepareErrorReport [line 798]
array prepareErrorReport(
[boolean
$showWarnings = true])
|
|
Pre-process and package errors and warnings for all files. Used by error reports to get a packaged list of all errors and warnings in each file.
Parameters:
printCheckstyleErrorReport [line 951]
int printCheckstyleErrorReport(
[boolean
$showWarnings = true])
|
|
Prints all errors and warnings for processed files, in a Checkstyle format. Errors and warnings are displayed together, grouped by file.
Parameters:
printCSVErrorReport [line 995]
int printCSVErrorReport(
[boolean
$showWarnings = true])
|
|
Prints all errors and warnings for each file processed, in a CSV format.
Parameters:
printEmacsErrorReport [line 1029]
int printEmacsErrorReport(
[boolean
$showWarnings = true])
|
|
Prints all errors and warnings for each file processed, in a format for emacs.
Parameters:
printErrorReport [line 1062]
int printErrorReport(
[boolean
$showWarnings = true], [boolean
$showSources = false])
|
|
Prints all errors and warnings for each file processed. Errors and warnings are displayed together, grouped by file.
Parameters:
printErrorReportSummary [line 1167]
int printErrorReportSummary(
[boolean
$showWarnings = true], [boolean
$showSources = false])
|
|
Prints a summary of errors and warnings for each file processed. If verbose output is enabled, results are shown for all files, even if they have no errors or warnings. If verbose output is disabled, we only show files that have at least one warning or error.
Parameters:
printSourceReport [line 1261]
int printSourceReport(
[boolean
$showWarnings = true], [boolean
$showSources = false])
|
|
Prints the source of all errors and warnings.
Parameters:
printXMLErrorReport [line 906]
int printXMLErrorReport(
[boolean
$showWarnings = true])
|
|
Prints all errors and warnings for each file processed, in an XML format. Errors and warnings are displayed together, grouped by file.
Parameters:
process [line 301]
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 729]
void processFile(
string
$file, [string
$contents = null])
|
|
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.
Parameters:
processFiles [line 660]
void processFiles(
string
$dir, [boolean
$local = false])
|
|
Run the code sniffs over each file in a given directory. Recusively reads the specified directory and performs the PHP_CodeSniffer sniffs on each source file found within the directories.
Parameters:
resolveSimpleToken [line 1549]
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 1506]
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 238]
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:
setConfigData [line 1952]
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 263]
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 459]
null setTokenListeners(
string
$standard, [
$sniffs = array()])
|
|
Sets installed sniffs in the coding standard being used.
Parameters:
standardiseToken [line 1465]
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 1766]
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 Mon, 17 Aug 2009 05:00:23 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.
|
|