PHP Класс Jyxo\Spl\MapIterator

Supports iteration over both \Traversable and array.
Автор: Jakub Tománek
Наследование: implements Countable, implements Jyxo\Spl\ArrayCopy, implements OuterIterator, implements SeekableIterator
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( array | Iterator | IteratorAggregate $data, callable $map ) Constructor.
count ( ) : integer Returns count of source data.
current ( ) : mixed Returns current data.
getInnerIterator ( ) : Iterator Returns inner iterator (works even when constructed with array data)
key ( ) : integer Returns current key.
next ( ) Advances the internal pointer.
rewind ( ) Rewinds the iterator to the beginning.
seek ( integer $position ) Seeks to defined position. Does NOT throw {@link \OutOfBoundsException}.
toArray ( ) : array Returns all data as an array.
valid ( ) : boolean Returns if current pointer position is valid.

Приватные методы

Метод Описание
map ( mixed $item ) : mixed Converts source data to result using a callback function.

Описание методов

__construct() публичный метод

Constructor.
public __construct ( array | Iterator | IteratorAggregate $data, callable $map )
$data array | Iterator | IteratorAggregate Source data
$map callable Applied callback or closure

count() публичный метод

Returns count of source data.
public count ( ) : integer
Результат integer

current() публичный метод

Returns current data.
public current ( ) : mixed
Результат mixed

getInnerIterator() публичный метод

Returns inner iterator (works even when constructed with array data)
public getInnerIterator ( ) : Iterator
Результат Iterator

key() публичный метод

Returns current key.
public key ( ) : integer
Результат integer

next() публичный метод

Advances the internal pointer.
public next ( )

rewind() публичный метод

Rewinds the iterator to the beginning.
public rewind ( )

seek() публичный метод

Seeks to defined position. Does NOT throw {@link \OutOfBoundsException}.
public seek ( integer $position )
$position integer New position

toArray() публичный метод

Returns all data as an array.
public toArray ( ) : array
Результат array

valid() публичный метод

Returns if current pointer position is valid.
public valid ( ) : boolean
Результат boolean