Methods summary
protected
|
#
__construct( )
Constructor.
Protected to ensure that the concrete implementation will override it.
Throws
|
final protected
|
#
processSource( string $source )
Extracts tokens from a source code.
Extracts tokens from a source code.
Parameters
- $source
string $source Source code
|
public
string
|
#
getFileName( )
Returns the file name this is a part of.
Returns the file name this is a part of.
Returns
string
|
public
string
|
#
getSource( )
Returns the original source code.
Returns the original source code.
Returns
string
|
public
string
|
#
getSourcePart( mixed $start = null, mixed $end = null )
Returns a part of the source code.
Returns a part of the source code.
Parameters
- $start
mixed $start Start offset
- $end
mixed $end End offset
Returns
string
|
public
TokenReflection\Stream|boolean
|
#
find( integer|string $type )
Finds the position of the token of the given type.
Finds the position of the token of the given type.
Parameters
- $type
integer|string $type Token type
Returns
TokenReflection\Stream|boolean
|
public
TokenReflection\Stream
|
#
findMatchingBracket( )
Returns the position of the token with the matching bracket.
Returns the position of the token with the matching bracket.
Returns
TokenReflection\Stream
Throws
|
public
TokenReflection\Stream\StreamBase
|
#
skipWhitespaces( boolean $skipDocBlocks = false )
Skips whitespaces and comments next to the current position.
Skips whitespaces and comments next to the current position.
Parameters
- $skipDocBlocks
boolean $skipDocBlocks Skip docblocks as well
Returns
|
public
boolean
|
#
isWhitespace( boolean $docBlock = false )
Returns if the token stream is at a whitespace position.
Returns if the token stream is at a whitespace position.
Parameters
- $docBlock
boolean $docBlock Consider docblocks as whitespaces
Returns
boolean
|
public
boolean
|
#
is( integer|string $type, integer $position = -1 )
Checks if there is a token of the given type at the given position.
Checks if there is a token of the given type at the given position.
Parameters
- $type
integer|string $type Token type
- $position
integer $position Position; if none given, consider the current iteration position
Returns
boolean
|
public
string|integer|null
|
#
getType( integer $position = -1 )
Returns the type of a token.
Returns the type of a token.
Parameters
- $position
integer $position Token position; if none given, consider the current iteration position
Returns
string|integer|null
|
public
stirng
|
#
getTokenValue( integer $position = -1 )
Returns the current token value.
Returns the current token value.
Parameters
- $position
integer $position Token position; if none given, consider the current iteration position
Returns
stirng
|
public
string|null
|
#
getTokenName( integer $position = -1 )
Returns the token type name.
Returns the token type name.
Parameters
- $position
integer $position Token position; if none given, consider the current iteration position
Returns
string|null
|
public
string
|
#
serialize( )
Stream serialization.
Returns
string
Implementation of
Serializable::serialize()
|
public
|
#
unserialize( string $serialized )
Restores the stream from the serialized state.
Restores the stream from the serialized state.
Parameters
- $serialized
string $serialized Serialized form
Throws
Implementation of
Serializable::unserialize()
|
public
boolean
|
#
offsetExists( integer $offset )
Checks of there is a token with the given index.
Checks of there is a token with the given index.
Parameters
- $offset
integer $offset Token index
Returns
boolean
Implementation of
ArrayAccess::offsetExists()
|
public
|
#
offsetUnset( integer $offset )
Removes a token.
Unsupported.
Parameters
- $offset
integer $offset Position
Throws
Implementation of
ArrayAccess::offsetUnset()
|
public
mixed
|
#
offsetGet( integer $offset )
Returns a token at the given index.
Returns a token at the given index.
Parameters
- $offset
integer $offset Token index
Returns
mixed
Implementation of
ArrayAccess::offsetGet()
|
public
|
#
offsetSet( integer $offset, mixed $value )
Sets a value of a particular token.
Sets a value of a particular token.
Unsupported
Parameters
- $offset
integer $offset Position
- $value
mixed $value Value
Throws
Implementation of
ArrayAccess::offsetSet()
|
public
integer
|
#
key( )
Returns the current internal pointer value.
Returns the current internal pointer value.
Returns
integer
Implementation of
Iterator::key()
|
public
TokenReflection\Stream
|
#
next( )
Advances the internal pointer.
Advances the internal pointer.
Returns
TokenReflection\Stream
Implementation of
Iterator::next()
|
public
TokenReflection\Stream
|
#
rewind( )
Sets the internal pointer to zero.
Sets the internal pointer to zero.
Returns
TokenReflection\Stream
Implementation of
Iterator::rewind()
|
public
array|null
|
#
current( )
Returns the current token.
Returns the current token.
Returns
array|null
Implementation of
Iterator::current()
|
public
boolean
|
#
valid( )
Checks if there is a token on the current position.
Checks if there is a token on the current position.
Returns
boolean
Implementation of
Iterator::valid()
|
public
integer
|
#
count( )
Returns the number of tokens in the stream.
Returns the number of tokens in the stream.
Returns
integer
Implementation of
Countable::count()
|
public
TokenReflection\Stream
|
#
seek( integer $position )
Sets the internal pointer to the given value.
Sets the internal pointer to the given value.
Parameters
- $position
integer $position New position
Returns
TokenReflection\Stream
Implementation of
SeekableIterator::seek()
|
public
string
|
#
__toString( )
Returns the stream source code.
Returns the stream source code.
Returns
string
|