PHP Class PhpCsFixer\Tokenizer\TokensAnalyzer

Its role is to provide the ability to analyze collection.
Author: Dariusz Rumiński ([email protected])
Author: Gregor Harlan ([email protected])
Exibir arquivo Open project: friendsofphp/php-cs-fixer Class Usage Examples

Public Methods

Method Description
__construct ( Tokens $tokens )
getClassyElements ( ) : array[] Get indexes of methods and properties in classy code (classes, interfaces and traits).
getImportUseIndexes ( boolean $perNamespace = false ) : array | array[] Get indexes of namespace uses.
getMethodAttributes ( integer $index ) : array Returns the attributes of the method under the given index.
isAnonymousClass ( integer $index ) : boolean Check if there is an anonymous class under given index.
isArray ( integer $index ) : boolean Check if there is an array at given index.
isArrayMultiLine ( integer $index ) : boolean Check if the array at index is multiline.
isBinaryOperator ( integer $index ) : boolean Checks if there is a binary operator under given index.
isLambda ( integer $index ) : boolean Check if the function under given index is a lambda.
isUnaryPredecessorOperator ( integer $index ) : boolean Checks if there is an unary predecessor operator under given index.
isUnarySuccessorOperator ( integer $index ) : boolean Checks if there is an unary successor operator under given index.
isWhilePartOfDoWhile ( integer $index ) : boolean Check if T_WHILE token at given index is `do { .

Method Details

__construct() public method

public __construct ( Tokens $tokens )
$tokens Tokens

getClassyElements() public method

Get indexes of methods and properties in classy code (classes, interfaces and traits).
public getClassyElements ( ) : array[]
return array[]

getImportUseIndexes() public method

Get indexes of namespace uses.
public getImportUseIndexes ( boolean $perNamespace = false ) : array | array[]
$perNamespace boolean Return namespace uses per namespace
return array | array[]

getMethodAttributes() public method

The array has the following items: 'visibility' int|null T_PRIVATE, T_PROTECTED or T_PUBLIC 'static' bool 'abstract' bool 'final' bool
public getMethodAttributes ( integer $index ) : array
$index integer Token index of the method (T_FUNCTION)
return array

isAnonymousClass() public method

Check if there is an anonymous class under given index.
public isAnonymousClass ( integer $index ) : boolean
$index integer
return boolean

isArray() public method

Check if there is an array at given index.
public isArray ( integer $index ) : boolean
$index integer
return boolean

isArrayMultiLine() public method

This only checks the root-level of the array.
public isArrayMultiLine ( integer $index ) : boolean
$index integer
return boolean

isBinaryOperator() public method

Checks if there is a binary operator under given index.
public isBinaryOperator ( integer $index ) : boolean
$index integer
return boolean

isLambda() public method

Check if the function under given index is a lambda.
public isLambda ( integer $index ) : boolean
$index integer
return boolean

isUnaryPredecessorOperator() public method

Checks if there is an unary predecessor operator under given index.
public isUnaryPredecessorOperator ( integer $index ) : boolean
$index integer
return boolean

isUnarySuccessorOperator() public method

Checks if there is an unary successor operator under given index.
public isUnarySuccessorOperator ( integer $index ) : boolean
$index integer
return boolean

isWhilePartOfDoWhile() public method

.. } while (); syntax and not while () { ...}`.
public isWhilePartOfDoWhile ( integer $index ) : boolean
$index integer
return boolean