class Map_Iterator implements Iterator (View source)

deprecated 4.13.0 Will be removed without equivalent functionality to replace it

Builds a map iterator around an Iterator. Called by Map

Properties

protected Iterator $items
protected $keyField
protected $titleField
protected $firstItemIdx
protected $endItemIdx
protected $firstItems
protected $lastItems
protected $excludedItems

Methods

public
__construct(Iterator $items, string $keyField, string $titleField, array $firstItems = null, array $lastItems = null)

No description

public
mixed
rewind()

Rewind the Iterator to the first element.

public
mixed
current()

Return the current element.

protected
mixed
extractValue(array|object $item, string $key)

Extracts a value from an item in the list, where the item is either an object or array.

public
string
key()

Return the key of the current element.

public
mixed
next()

Move forward to next element.

public
bool
valid()

Checks if current position is valid.

Details

__construct(Iterator $items, string $keyField, string $titleField, array $firstItems = null, array $lastItems = null)

No description

Parameters

Iterator $items

The iterator to build this map from

string $keyField

The field to use for the keys

string $titleField

The field to use for the values

array $firstItems

An optional map of items to show first

array $lastItems

An optional map of items to show last

mixed rewind()

Rewind the Iterator to the first element.

Return Value

mixed

mixed current()

Return the current element.

Return Value

mixed

protected mixed extractValue(array|object $item, string $key)

Extracts a value from an item in the list, where the item is either an object or array.

Parameters

array|object $item
string $key

Return Value

mixed

string key()

Return the key of the current element.

Return Value

string

mixed next()

Move forward to next element.

Return Value

mixed

bool valid()

Checks if current position is valid.

Return Value

bool