\SuperClosure\AnalyzerToken

A Token object represents and individual token parsed from PHP code.

Each Token object is a normalized token created from the result of the get_token_all(). function, which is part of PHP's tokenizer.

Summary

Methods
Properties
Constants
__construct()
is()
__toString()
$name
$value
$code
$line
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$name

$name : string

Type

string — The token name. Always null for literal tokens.

$value

$value : integer|null

Type

integer|null — The token's integer value. Always null for literal tokens.

$code

$code : string

Type

string — The PHP code of the token.

$line

$line : integer|null

Type

integer|null — The line number of the token in the original code.

Methods

__construct()

__construct(string  $code, integer|null  $value = null, integer|null  $line = null) 

Constructs a token object.

Parameters

string $code
integer|null $value
integer|null $line

Throws

\InvalidArgumentException

is()

is(mixed  $value) : boolean

Determines if the token's value/code is equal to the specified value.

Parameters

mixed $value

The value to check.

Returns

boolean —

True if the token is equal to the value.

__toString()

__toString()