PHP 클래스 Kahlan\Jit\TokenStream

상속: implements ArrayAccess, implements Countable, implements SeekableIterator
파일 보기 프로젝트 열기: crysalead/kahlan 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_current integer Current pointer key value.
$_data array The items contained in the collection.

공개 메소드들

메소드 설명
__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.

보호된 메소드들

메소드 설명
_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.

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( $options = [] )

__toString() 공개 메소드

Returns the stream source code.
public __toString ( ) : string
리턴 string

_getToken() 보호된 메소드

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

_skip() 보호된 메소드

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.
리턴 The skipped string.

count() 공개 메소드

Counts the items of the object.
public count ( ) : integer
리턴 integer Returns the number of items in the collection.

current() 공개 메소드

Returns the current token or the token value.
public current ( $token = false ) : array | string
리턴 array | string

getName() 공개 메소드

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

getType() 공개 메소드

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

getValue() 공개 메소드

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

is() 공개 메소드

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.
리턴 boolean

key() 공개 메소드

Returns the current internal pointer value.
public key ( ) : integer
리턴 integer

load() 공개 메소드

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

next() 공개 메소드

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

nextMatchingBracket() 공개 메소드

Move to the next matching bracket.
public nextMatchingBracket ( ) : string | null
리턴 string | null Returns the skipped text content.

nextSequence() 공개 메소드

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

offsetExists() 공개 메소드

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

offsetGet() 공개 메소드

Returns a token at the given index.
public offsetGet ( integer $offset ) : array
$offset integer Token index
리턴 array

offsetSet() 공개 메소드

Unsupported
public offsetSet ( $offset, $value )

offsetUnset() 공개 메소드

Unsupported
public offsetUnset ( $offset )

prev() 공개 메소드

Move to previous.
public prev ( $token = false ) : array | string
리턴 array | string

rewind() 공개 메소드

Sets the internal pointer to zero.
public rewind ( $token = false ) : array | string
리턴 array | string

seek() 공개 메소드

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

skipWhile() 공개 메소드

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.
리턴 The skipped string.

skipWhitespaces() 공개 메소드

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

source() 공개 메소드

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

valid() 공개 메소드

Checks if there is a token on the current position.
public valid ( ) : boolean
리턴 boolean

프로퍼티 상세

$_current 보호되어 있는 프로퍼티

Current pointer key value.
protected int $_current
리턴 integer

$_data 보호되어 있는 프로퍼티

The items contained in the collection.
protected array $_data
리턴 array