PHP_CodeSniffer
[ class tree: PHP_CodeSniffer ] [ index: PHP_CodeSniffer ] [ all elements ]
Packages:
PHP_CodeSniffer


Classes:
PEAR_Sniffs_Commenting_InlineCommentSniff
PEAR_Sniffs_Constants_ValidConstantNameSniff
PEAR_Sniffs_ControlStructures_ControlSignatureSniff
PEAR_Sniffs_Files_IncludingFileSniff
PEAR_Sniffs_Files_LineLengthSniff
PEAR_Sniffs_Methods_FunctionCallSignatureSniff
PEAR_Sniffs_Methods_MethodCallArgumentSpacingSniff
PEAR_Sniffs_Methods_OpeningMethodBraceSniff
PEAR_Sniffs_Methods_ValidDefaultValueSniff
PEAR_Sniffs_Misc_ShortOpenTagSniff
PEAR_Sniffs_NamingConventions_ValidClassNameSniff
PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff
PEAR_Sniffs_PHP_LowerCaseConstantSniff
PEAR_Sniffs_Statements_MultipleStatementSniff
PEAR_Sniffs_Whitespace_ScopeClosingBraceSniff
PEAR_Sniffs_Whitespace_ScopeIndentSniff
PHP_CodeSniffer
PHP_CodeSniffer_CommentParser_AbstractDocElement
PHP_CodeSniffer_CommentParser_AbstractParser
PHP_CodeSniffer_CommentParser_ClassCommentParser
PHP_CodeSniffer_CommentParser_CommentElement
PHP_CodeSniffer_CommentParser_FunctionCommentParser
PHP_CodeSniffer_CommentParser_MemberCommentParser
PHP_CodeSniffer_CommentParser_PairElement
PHP_CodeSniffer_CommentParser_ParameterElement
PHP_CodeSniffer_CommentParser_ParserException
PHP_CodeSniffer_CommentParser_SingleElement
PHP_CodeSniffer_Exception
PHP_CodeSniffer_File
PHP_CodeSniffer_Sniff_Exception
PHP_CodeSniffer_Standards_AbstractPatternSniff
PHP_CodeSniffer_Standards_AbstractScopeSniff
PHP_CodeSniffer_Standards_AbstractVariableSniff
PHP_CodeSniffer_Standards_IncorrectPatternException
PHP_CodeSniffer_Tokens
Files:
AbstractDocElement.php
AbstractParser.php
AbstractPatternSniff.php
AbstractScopeSniff.php
AbstractVariableSniff.php
ClassCommentParser.php
CodeSniffer.php
CommentElement.php
ControlSignatureSniff.php
DocElement.php
Exception.php
File.php
FunctionCallSignatureSniff.php
FunctionCommentParser.php
IncludingFileSniff.php
IncorrectPatternException.php
InlineCommentSniff.php
LineLengthSniff.php
LowerCaseConstantSniff.php
MemberCommentParser.php
MethodCallArgumentSpacingSniff.php
MultipleStatementSniff.php
OpeningMethodBraceSniff.php
PairElement.php
ParameterElement.php
ParserException.php
ScopeClosingBraceSniff.php
ScopeIndentSniff.php
ShortOpenTagSniff.php
SingleElement.php
Sniff.php
SniffException.php
Tokens.php
ValidClassNameSniff.php
ValidConstantNameSniff.php
ValidDefaultValueSniff.php
ValidFunctionNameSniff.php

Class: PHP_CodeSniffer_Tokens

Source Location: /PHP_CodeSniffer-0.1.1/CodeSniffer/Tokens.php

Class Overview


The Tokens class contains weightings for tokens based on their probability of occurance in a file.


Author(s):

  • Squiz Pty Ltd

Variables

Methods


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.

  • Author: Squiz Pty Ltd


[ Top ]


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.
  • Access: public

Type: array(int)


[ Top ]

$commentTokens = array(
T_COMMENT,
T_DOC_COMMENT,
)

[line 242]

Tokens that are comments.
  • Access: public

Type: array(int)


[ Top ]

$emptyTokens = array(
T_WHITESPACE,
T_COMMENT,
T_DOC_COMMENT,
)

[line 230]

Tokens that don't represent code.
  • Access: public

Type: array(int)


[ Top ]

$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.
  • Access: public

Type: array(int)


[ Top ]

$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.
  • Access: public

Type: array(int)


[ Top ]

$scopeModifiers = array(
T_PRIVATE,
T_PUBLIC,
T_PROTECTED,
)

[line 202]

Tokens that represent scope modifiers.
  • Access: public

Type: array(int)


[ Top ]

$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.
  • Access: public

Type: array(int)


[ Top ]

$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.

  • Access: public

Type: array(int)


[ Top ]

$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

Type: array(int


[ Top ]



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.

[ Top ]


Documentation generated on 2019年3月11日 14:44:51 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.

AltStyle によって変換されたページ (->オリジナル) /