Documentation

Token
in package

Represents a Token.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

ARROW_TYPE  = 12
BLOCK_END_TYPE  = 3
BLOCK_START_TYPE  = 1
EOF_TYPE  = -1
INTERPOLATION_END_TYPE  = 11
INTERPOLATION_START_TYPE  = 10
NAME_TYPE  = 5
NUMBER_TYPE  = 6
OPERATOR_TYPE  = 8
PUNCTUATION_TYPE  = 9
STRING_TYPE  = 7
TEXT_TYPE  = 0
VAR_END_TYPE  = 4
VAR_START_TYPE  = 2
$lineno  : mixed
$type  : mixed
$value  : mixed
__construct()  : mixed
__toString()  : mixed
getLine()  : int
getType()  : int
getValue()  : string
test()  : bool
Tests the current token for a type and/or a value.
typeToEnglish()  : string
Returns the English representation of a given type.
typeToString()  : string
Returns the constant representation (internal) of a given type.

Constants

ARROW_TYPE

public mixed ARROW_TYPE = 12

BLOCK_END_TYPE

public mixed BLOCK_END_TYPE = 3

BLOCK_START_TYPE

public mixed BLOCK_START_TYPE = 1

EOF_TYPE

public mixed EOF_TYPE = -1

INTERPOLATION_END_TYPE

public mixed INTERPOLATION_END_TYPE = 11

INTERPOLATION_START_TYPE

public mixed INTERPOLATION_START_TYPE = 10

NAME_TYPE

public mixed NAME_TYPE = 5

NUMBER_TYPE

public mixed NUMBER_TYPE = 6

OPERATOR_TYPE

public mixed OPERATOR_TYPE = 8

PUNCTUATION_TYPE

public mixed PUNCTUATION_TYPE = 9

STRING_TYPE

public mixed STRING_TYPE = 7

TEXT_TYPE

public mixed TEXT_TYPE = 0

VAR_END_TYPE

public mixed VAR_END_TYPE = 4

VAR_START_TYPE

public mixed VAR_START_TYPE = 2

Properties

$lineno

private mixed $lineno

Methods

__construct()

public __construct(int $type, string $value, int $lineno) : mixed
Parameters
$type : int

The type of the token

$value : string

The token value

$lineno : int

The line position in the source

Return values
mixed

__toString()

public __toString() : mixed
Return values
mixed

getLine()

public getLine() : int
Return values
int

getType()

public getType() : int
Return values
int

getValue()

public getValue() : string
Return values
string

test()

Tests the current token for a type and/or a value.

public test(array<string|int, mixed>|string|int $type[, array<string|int, mixed>|string|null $values = null ]) : bool

Parameters may be:

  • just type
  • type and value (or array of possible values)
  • just value (or array of possible values) (NAME_TYPE is used as type)
Parameters
$type : array<string|int, mixed>|string|int

The type to test

$values : array<string|int, mixed>|string|null = null

The token value

Return values
bool

typeToEnglish()

Returns the English representation of a given type.

public static typeToEnglish(int $type) : string
Parameters
$type : int

The type as an integer

Return values
string

The string representation

typeToString()

Returns the constant representation (internal) of a given type.

public static typeToString(int $type[, bool $short = false ]) : string
Parameters
$type : int

The type as an integer

$short : bool = false

Whether to return a short representation or not

Return values
string

The string representation

Search results