Overview

Namespaces

  • Yep
    • Tokenizer

Classes

  • PhpTokenizer
  • TokenIterator
  • Tokenizer

Interfaces

  • ITokenizer

Exceptions

  • UnexpectedTokenException
  • Overview
  • Namespace
  • Class

Class TokenIterator

Yep\Tokenizer\TokenIterator implements Iterator, SeekableIterator
Namespace: Yep\Tokenizer
Located at TokenIterator.php
Methods summary
public
# __construct( array $tokens )

TokenIterator constructor

TokenIterator constructor

Parameters

$tokens
public array|null
# current( )

Returns current token

Returns current token

Returns

array|null

Implementation of

Iterator::current()
public
# next( )

Moves to next position

Moves to next position

Implementation of

Iterator::next()
public integer
# key( )

Returns current position

Returns current position

Returns

integer

Implementation of

Iterator::key()
public boolean
# valid( )

Returns true, if current position is valid.

Returns true, if current position is valid.

Returns

boolean

Implementation of

Iterator::valid()
public
# rewind( )

Moves to begin

Moves to begin

Implementation of

Iterator::rewind()
public
# prev( )

Moves to previous position

Moves to previous position

public array|null
# step( boolean $back = false )

Moves to next or previous position and returns token, if is valid.

Moves to next or previous position and returns token, if is valid.

Parameters

$back

Returns

array|null
public
# seek( integer $position )

Moves to specific position

Moves to specific position

Parameters

$position

Implementation of

SeekableIterator::seek()
public boolean
# currentIs( )

Checks the current token

Checks the current token

Returns

boolean
public string|null
# currentValue( )

Returns current token value

Returns current token value

Returns

string|null
protected array|null|string
# doSomethingMagic( array $tokens = [], boolean $expected = true, boolean $only_first = false, boolean $join = false, boolean $prev = false )

Magic method which find and returns tokens

Magic method which find and returns tokens

Parameters

$tokens
$expected
$only_first
$join
$prev

Returns

array|null|string
public
# nextOne( )
public
# prevOne( )
public
# nextOneNot( )
public
# prevOneNot( )
public
# nextOneValue( )
public
# prevOneValue( )
public
# nextAll( )
public
# prevAll( )
public
# nextUntil( )
public
# prevUntil( )
public
# joinNext( )
public
# joinPrev( )
public
# joinNextUntil( )
public
# joinPrevUntil( )
Properties summary
protected integer $position
# -1
protected array $tokens
# []
API documentation generated by ApiGen