Iterator class responsible for navigating through an array forwards and backwards.

category phpDocumentor
package Reflection
author Mike van Riel
license MIT
link http://phpdoc.org

 Methods

Initializes the iterator and populate the pointer array.

__construct(array $data) 

Parameters

$data

\phpDocumentor_Reflection_Token[]

Tokens to store.

Returns a count of the items contained in this iterator.

count() : int

Returns

int

Returns the currently selected item.

current() : mixed

Returns

mixed

Returns the key of the currently active item.

key() : int | null

Returns

intnull

Returns true if an item exists.

offsetExists(integer $offset) : bool

Parameters

$offset

integer

the index to check.

Returns

bool

Returns the value from the given $offset; or null when no item could be found.

offsetGet(string $offset) : mixed | null

Parameters

$offset

string

The index to retrieve.

Returns

mixednull

Due to the pointers it is not allowed to add an item onto the array.

offsetSet(integer $offset, \phpDocumentor_Reflection_Token $value) : void

Parameters

$offset

integer

Offset to overwrite.

$value

\phpDocumentor_Reflection_Token

Token to overwrite entry with.

Exceptions

\BadMethodCallException when the user tries to add an item.

Due to the pointers it is not allowed to remove an item from the array.

offsetUnset(int $offset) : void

Parameters

$offset

int

Offset to remove.

Exceptions

\BadMethodCallException if the user invokes this method.

Sets the array pointer to the first item and returns that item.

rewind() : mixed | null

Returns

mixednull

Moves the pointer to a specific position in the store.

seek(int | string $key) : mixed

NOTE: this function is used A LOT during the reflection process. This should be as high-performance as possible and ways should be devised to not use it.

Parameters

$key

intstring

the index to move to.

Returns

mixed

Serialize the store.

serialize() : string

Returns

string

Load a serialized store and populate the pointers.

unserialize(string $serialized) : void

Parameters

$serialized

string

String to unserialize.

Returns true if the pointer is at an existing item.

valid() : boolean

Returns

boolean

 Properties

 

<p>Count of items</p>

$count : int

 

<p>Current value</p>

$current : mixed

 

<p>Current key value</p>

$key : int

 

<p>Contents for this iterator</p>

$store : \mixed[]