PHP Class Kahlan\Jit\TokenStream

Inheritance: implements ArrayAccess, implements Countable, implements SeekableIterator
Afficher le fichier Open project: crysalead/kahlan Class Usage Examples

Protected Properties

Свойство Type Description
$_current integer Current pointer key value.
$_data array The items contained in the collection.

Méthodes publiques

Méthode Description
__construct ( $options = [] ) Constructor
__toString ( ) : string Returns the stream source code.
count ( ) : integer Counts the items of the object.
current ( $token = false ) : array | string Returns the current token or the token value.
getName ( integer $index = null ) : string | null Returns the token type name.
getType ( integer $index = null ) : mixed Returns the type of a token.
getValue ( integer $index = null ) : string | null Returns the current token value.
is ( integer | string $type, integer $index = null ) : boolean Checks if there is a token of the given type at the given position.
key ( ) : integer Returns the current internal pointer value.
load ( string $source, $options = [] ) Load the stream using a string (destroy previous loaded tokens)
next ( mixed $type = false ) : string | null Move to the next token of a given type.
nextMatchingBracket ( ) : string | null Move to the next matching bracket.
nextSequence ( $sequence ) : array | null Moves to the next sequence of tokens.
offsetExists ( integer $offset ) : boolean Checks of there is a token with the given index.
offsetGet ( integer $offset ) : array Returns a token at the given index.
offsetSet ( $offset, $value ) Unsupported
offsetUnset ( $offset ) Unsupported
prev ( $token = false ) : array | string Move to previous.
rewind ( $token = false ) : array | string Sets the internal pointer to zero.
seek ( integer $index, $token = false ) : array | string Move to a specific index.
skipWhile ( array $skips = [] ) : The Skips elements until an element doesn't match the elements in the passed array.
skipWhitespaces ( boolean $skipComment = false ) : The Skips whitespaces and comments next to the current position.
source ( mixed $start = null, mixed $end = null ) : string Returns the stream content.
valid ( ) : boolean Checks if there is a token on the current position.

Méthodes protégées

Méthode Description
_getToken ( integer $index, $type ) : string | null Returns the current token value.
_skip ( array $skips ) : The Skips elements until an element doesn't match the elements in the passed array.

Method Details

__construct() public méthode

Constructor
public __construct ( $options = [] )

__toString() public méthode

Returns the stream source code.
public __toString ( ) : string
Résultat string

_getToken() protected méthode

Returns the current token value.
protected _getToken ( integer $index, $type ) : string | null
$index integer Token position, if none given, consider the current iteration position.
Résultat string | null

_skip() protected méthode

Skips elements until an element doesn't match the elements in the passed array.
protected _skip ( array $skips ) : The
$skips array The elements array to skip.
Résultat The skipped string.

count() public méthode

Counts the items of the object.
public count ( ) : integer
Résultat integer Returns the number of items in the collection.

current() public méthode

Returns the current token or the token value.
public current ( $token = false ) : array | string
Résultat array | string

getName() public méthode

Returns the token type name.
public getName ( integer $index = null ) : string | null
$index integer Token position, if none given, consider the current iteration position.
Résultat string | null

getType() public méthode

Returns the type of a token.
public getType ( integer $index = null ) : mixed
$index integer Token position, if none given, consider the current iteration position.
Résultat mixed

getValue() public méthode

Returns the current token value.
public getValue ( integer $index = null ) : string | null
$index integer Token position, if none given, consider the current iteration position.
Résultat string | null

is() public méthode

Checks if there is a token of the given type at the given position.
public is ( integer | string $type, integer $index = null ) : boolean
$type integer | string Token type.
$index integer Token position, if none given, consider the current iteration position.
Résultat boolean

key() public méthode

Returns the current internal pointer value.
public key ( ) : integer
Résultat integer

load() public méthode

Load the stream using a string (destroy previous loaded tokens)
public load ( string $source, $options = [] )
$source string Source code

next() public méthode

Move to the next token of a given type.
public next ( mixed $type = false ) : string | null
$type mixed Token type to search for.
Résultat string | null Returns the skipped text content (the current is not saved).

nextMatchingBracket() public méthode

Move to the next matching bracket.
public nextMatchingBracket ( ) : string | null
Résultat string | null Returns the skipped text content.

nextSequence() public méthode

Moves to the next sequence of tokens.
public nextSequence ( $sequence ) : array | null
Résultat array | null Returns the skipped text content (the current is not saved).

offsetExists() public méthode

Checks of there is a token with the given index.
public offsetExists ( integer $offset ) : boolean
$offset integer Token index
Résultat boolean

offsetGet() public méthode

Returns a token at the given index.
public offsetGet ( integer $offset ) : array
$offset integer Token index
Résultat array

offsetSet() public méthode

Unsupported
public offsetSet ( $offset, $value )

offsetUnset() public méthode

Unsupported
public offsetUnset ( $offset )

prev() public méthode

Move to previous.
public prev ( $token = false ) : array | string
Résultat array | string

rewind() public méthode

Sets the internal pointer to zero.
public rewind ( $token = false ) : array | string
Résultat array | string

seek() public méthode

Move to a specific index.
public seek ( integer $index, $token = false ) : array | string
$index integer New position
Résultat array | string

skipWhile() public méthode

Skips elements until an element doesn't match the elements in the passed array.
public skipWhile ( array $skips = [] ) : The
$skips array The elements array to skip.
Résultat The skipped string.

skipWhitespaces() public méthode

Skips whitespaces and comments next to the current position.
public skipWhitespaces ( boolean $skipComment = false ) : The
$skipComment boolean Skip docblocks as well.
Résultat The skipped string.

source() public méthode

Returns the stream content.
public source ( mixed $start = null, mixed $end = null ) : string
$start mixed Start offset
$end mixed End offset
Résultat string

valid() public méthode

Checks if there is a token on the current position.
public valid ( ) : boolean
Résultat boolean

Property Details

$_current protected_oe property

Current pointer key value.
protected int $_current
Résultat integer

$_data protected_oe property

The items contained in the collection.
protected array $_data
Résultat array