PHP Class SqlParser\TokensList

Inheritance: implements ArrayAccess
显示文件 Open project: phpmyadmin/sql-parser Class Usage Examples

Public Properties

Property Type Description
$count integer The count of tokens.
$idx integer The index of the next token to be returned.
$tokens array The array of tokens.

Public Methods

Method Description
__construct ( array $tokens = [], integer $count ) Constructor.
add ( Token $token ) : void Adds a new token.
build ( string | Token[] | TokensList $list ) : string Builds an array of tokens by merging their raw value.
getNext ( ) : Token Gets the next token. Skips any irrelevant token (whitespaces and comments).
getNextOfType ( integer $type ) : Token Gets the next token.
getNextOfTypeAndValue ( integer $type, string $value ) : Token Gets the next token.
offsetExists ( integer $offset ) : boolean Checks if an offset was previously set.
offsetGet ( integer $offset ) : Token Gets a value from the container.
offsetSet ( integer $offset, Token $value ) : void Sets an value inside the container.
offsetUnset ( integer $offset ) : void Unsets the value of an offset.

Method Details

__construct() public method

Constructor.
public __construct ( array $tokens = [], integer $count )
$tokens array The initial array of tokens.
$count integer The count of tokens in the initial array.

add() public method

Adds a new token.
public add ( Token $token ) : void
$token Token Token to be added in list.
return void

build() public static method

Builds an array of tokens by merging their raw value.
public static build ( string | Token[] | TokensList $list ) : string
$list string | Token[] | TokensList The tokens to be built.
return string

getNext() public method

Gets the next token. Skips any irrelevant token (whitespaces and comments).
public getNext ( ) : Token
return Token

getNextOfType() public method

Gets the next token.
public getNextOfType ( integer $type ) : Token
$type integer The type.
return Token

getNextOfTypeAndValue() public method

Gets the next token.
public getNextOfTypeAndValue ( integer $type, string $value ) : Token
$type integer The type of the token.
$value string The value of the token.
return Token

offsetExists() public method

Checks if an offset was previously set.
public offsetExists ( integer $offset ) : boolean
$offset integer The offset to be checked.
return boolean

offsetGet() public method

Gets a value from the container.
public offsetGet ( integer $offset ) : Token
$offset integer The offset to be returned.
return Token

offsetSet() public method

Sets an value inside the container.
public offsetSet ( integer $offset, Token $value ) : void
$offset integer The offset to be set.
$value Token The token to be saved.
return void

offsetUnset() public method

Unsets the value of an offset.
public offsetUnset ( integer $offset ) : void
$offset integer The offset to be unset.
return void

Property Details

$count public_oe property

The count of tokens.
public int $count
return integer

$idx public_oe property

The index of the next token to be returned.
public int $idx
return integer

$tokens public_oe property

The array of tokens.
public array $tokens
return array