$arithmeticTokens = array(
T_PLUS,
T_MINUS,
T_MULTIPLY,
T_DIVIDE,
T_MODULUS,
)
[line 191]
Tokens that represent arithmetic operators.
$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 144]
Tokens that represent assignments.
$blockOpeners = array(
T_OPEN_CURLY_BRACKET,
T_OPEN_SQUARE_BRACKET,
T_OPEN_PARENTHESIS,
)
[line 285]
Tokens that perform operations.
$castTokens = array(
T_INT_CAST,
T_STRING_CAST,
T_DOUBLE_CAST,
T_ARRAY_CAST,
T_BOOL_CAST,
T_OBJECT_CAST,
T_UNSET_CAST
)
[line 204]
Tokens that represent casting.
$commentTokens = array(
T_COMMENT,
T_DOC_COMMENT,
)
[line 307]
Tokens that are comments.
$comparisonTokens = array(
T_IS_EQUAL,
T_IS_IDENTICAL,
T_IS_NOT_EQUAL,
T_IS_NOT_IDENTICAL,
T_LESS_THAN,
T_GREATER_THAN,
T_IS_SMALLER_OR_EQUAL,
T_IS_GREATER_OR_EQUAL,
)
[line 175]
Tokens that represent comparison operator.
$emptyTokens = array(
T_WHITESPACE,
T_COMMENT,
T_DOC_COMMENT,
)
[line 296]
Tokens that don't represent code.
$equalityTokens = array(
T_IS_EQUAL,
T_IS_NOT_EQUAL,
T_IS_IDENTICAL,
T_IS_NOT_IDENTICAL,
T_IS_SMALLER_OR_EQUAL,
T_IS_GREATER_OR_EQUAL,
)
[line 161]
Tokens that represent equality comparisons.
$includeTokens = array(
T_REQUIRE_ONCE,
T_REQUIRE,
T_INCLUDE_ONCE,
T_INCLUDE,
)
[line 329]
Tokens that include files.
$operators = array(
T_MINUS,
T_PLUS,
T_MULTIPLY,
T_DIVIDE,
T_MODULUS,
T_POWER,
T_BITWISE_AND,
T_BITWISE_OR,
)
[line 269]
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 219]
Token types that open parethesis.
$scopeModifiers = array(
T_PRIVATE,
T_PUBLIC,
T_PROTECTED,
)
[line 258]
Tokens that represent scope modifiers.
$scopeOpeners = array(
T_CLASS,
T_FUNCTION,
T_IF,
T_SWITCH,
T_CASE,
T_DEFAULT,
T_WHILE,
T_ELSE,
T_ELSEIF,
T_FOR,
T_FOREACH,
T_DO,
T_TRY,
T_CATCH,
)
[line 236]
Tokens that are allowed to open scopes.
$stringTokens = array(
T_CONSTANT_ENCAPSED_STRING,
T_DOUBLE_QUOTED_STRING,
)
[line 319]
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 74]
The token weightings.
- Var: => int)
- Access: public
getHighestWeightedToken [line 363]
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.