Class: PHP_CodeSniffer_Tokens
Source Location: /PHP_CodeSniffer-0.1.1/CodeSniffer/Tokens.php
The Tokens class contains weightings for tokens based on their probability of occurance in a file.
Author(s):
Inherited Variables
Inherited Methods
Class Details
[line 75]
The Tokens class contains weightings for tokens based on their probability of occurance in a file.
The less the chance of a high occurance of an abitrary token, the higher the weighting.
Class Variables
$assignmentTokens = array(
T_EQUAL,
T_AND_EQUAL,
T_CONCAT_EQUAL,
T_DIV_EQUAL,
T_MINUS_EQUAL,
T_MOD_EQUAL,
T_MUL_EQUAL,
T_PLUS_EQUAL,
T_XOR_EQUAL,
)
[line 148]
Tokens that represent assignments.
$commentTokens = array(
T_COMMENT,
T_DOC_COMMENT,
)
[line 242]
Tokens that are comments.
$emptyTokens = array(
T_WHITESPACE,
T_COMMENT,
T_DOC_COMMENT,
)
[line 230]
Tokens that don't represent code.
$operators = array(
T_MINUS,
T_PLUS,
T_MULTIPLY,
T_DIVIDE,
T_MODULUS,
T_POWER,
T_BITWISE_AND,
T_BITWISE_OR,
)
[line 213]
Tokens that perform operations.
$parenthesisOpeners = array(
T_ARRAY,
T_FUNCTION,
T_WHILE,
T_FOR,
T_FOREACH,
T_SWITCH,
T_IF,
T_ELSEIF,
T_CATCH,
)
[line 165]
Token types that open parethesis.
$scopeModifiers = array(
T_PRIVATE,
T_PUBLIC,
T_PROTECTED,
)
[line 202]
Tokens that represent scope modifiers.
$scopeOpeners = array(
T_CLASS,
T_FUNCTION,
T_IF,
T_SWITCH,
T_WHILE,
T_ELSE,
T_ELSEIF,
T_FOR,
T_FOREACH,
T_DO,
T_TRY,
T_CATCH,
)
[line 182]
Tokens that are allowed to open scopes.
$stringTokens = array(
T_CONSTANT_ENCAPSED_STRING,
T_DOUBLE_QUOTED_STRING,
)
[line 254]
Tokens that represent strings.
Note that T_STRINGS are NOT represented in this list.
$weightings = array(
T_CLASS => 1000,
T_FUNCTION => 100,
//-- CONDITIONS --//
T_WHILE => 50,
T_FOR => 50,
T_FOREACH => 50,
T_IF => 50,
T_ELSE => 50,
T_ELSEIF => 50,
T_WHILE => 50,
T_DO => 50,
T_TRY => 50,
T_CATCH => 50,
T_SWITCH => 50,
T_SELF => 25,
T_PARENT => 25,
//-- OPERATORS AND ARITHMETIC --//
T_BITWISE_AND => 8,
T_BITWISE_OR => 8,
T_MULTIPLY => 5,
T_DIVIDE => 5,
T_PLUS => 5,
T_MINUS => 5,
T_MODULUS => 5,
T_POWER => 5,
T_EQUAL => 5,
T_AND_EQUAL => 5,
T_CONCAT_EQUAL => 5,
T_DIV_EQUAL => 5,
T_MINUS_EQUAL => 5,
T_MOD_EQUAL => 5,
T_MUL_EQUAL => 5,
T_OR_EQUAL => 5,
T_PLUS_EQUAL => 5,
T_XOR_EQUAL => 5,
T_BOOLEAN_AND => 5,
T_BOOLEAN_OR => 5,
//-- EQUALITY --//
T_IS_EQUAL => 5,
T_IS_NOT_EQUAL => 5,
T_IS_IDENTICAL => 5,
T_IS_NOT_IDENTICAL => 5,
T_IS_SMALLER_OR_EQUAL => 5,
T_IS_GREATER_OR_EQUAL => 5,
T_WHITESPACE => 0,
)
[line 83]
The token weightings.
- Var: => int)
- Access: public
Method Detail
getHighestWeightedToken [line 286]
int getHighestWeightedToken(
array
$tokens)
Returns the highest weighted token type.
Tokens are weighted by their approximate frequency of appearance in code
- the less frequently they appear in the code, the higher the weighting.
For example T_CLASS tokens apprear very infrequently in a file, and therefore have a high weighting.
Returns false if there are no weightings for any of the specified tokens.
- Return: The highest weighted token.
- Access: public
Parameters:
array(int)
$tokens
—
The token types to get the highest weighted type for.
Documentation generated on 2019年3月11日 14:44:51 -0400 by
phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.