PHP Класс Ouzo\Utilities\Iterator\Iterators

Показать файл Открыть проект

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

Метод Описание
batch ( Iterator $iterator, $chunkSize ) : BatchingIterator Returns the elements of $iterator grouped in chunks of $chunkSize
cycle ( Iterator $iterator ) : InfiniteIterator Returns an iterator that cycles indefinitely over the elements of $iterator.
filter ( Iterator $iterator, $predicate ) : FilteringIterator Returns the elements of $iterator that satisfy a predicate.
first ( Iterator $iterator ) : mixed Returns the first element in iterator or throws an Exception if iterator is empty
firstOr ( Iterator $iterator, $default ) : mixed Returns the first element in iterator or defaultValue.
forArray ( $array ) : ArrayIterator Returns an iterator containing the elements of $array.
generate ( $function ) : GeneratingIterator Returns an iterator that uses $function to generate elements $function takes one argument which is the current position of the iterator.
limit ( Iterator $iterator, $number ) : LimitIterator Creates an iterator returning the first $number elements of the given iterator.
map ( Iterator $iterator, $function ) : TransformingIterator Returns an iterator that applies function to each element of $iterator.
reindex ( Iterator $iterator ) : Iterator Returns an iterator that indexes elements numerically starting from 0
skip ( Iterator $iterator, $number ) : SkippingIterator Creates an iterator returning all but first $number elements of the given iterator.
toArray ( Iterator $iterator ) : array Copies an iterator's elements into an array.

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

batch() публичный статический метод

Returns the elements of $iterator grouped in chunks of $chunkSize
public static batch ( Iterator $iterator, $chunkSize ) : BatchingIterator
$iterator Iterator
$chunkSize
Результат BatchingIterator

cycle() публичный статический метод

Returns an iterator that cycles indefinitely over the elements of $iterator.
public static cycle ( Iterator $iterator ) : InfiniteIterator
$iterator Iterator
Результат InfiniteIterator

filter() публичный статический метод

Returns the elements of $iterator that satisfy a predicate.
public static filter ( Iterator $iterator, $predicate ) : FilteringIterator
$iterator Iterator
$predicate
Результат FilteringIterator

first() публичный статический метод

Returns the first element in iterator or throws an Exception if iterator is empty
public static first ( Iterator $iterator ) : mixed
$iterator Iterator
Результат mixed

firstOr() публичный статический метод

Returns the first element in iterator or defaultValue.
public static firstOr ( Iterator $iterator, $default ) : mixed
$iterator Iterator
$default
Результат mixed

forArray() публичный статический метод

Returns an iterator containing the elements of $array.
public static forArray ( $array ) : ArrayIterator
$array
Результат ArrayIterator

generate() публичный статический метод

Returns an iterator that uses $function to generate elements $function takes one argument which is the current position of the iterator.
public static generate ( $function ) : GeneratingIterator
$function
Результат GeneratingIterator

limit() публичный статический метод

Creates an iterator returning the first $number elements of the given iterator.
public static limit ( Iterator $iterator, $number ) : LimitIterator
$iterator Iterator
$number
Результат LimitIterator

map() публичный статический метод

Returns an iterator that applies function to each element of $iterator.
public static map ( Iterator $iterator, $function ) : TransformingIterator
$iterator Iterator
$function
Результат TransformingIterator

reindex() публичный статический метод

Returns an iterator that indexes elements numerically starting from 0
public static reindex ( Iterator $iterator ) : Iterator
$iterator Iterator
Результат Iterator

skip() публичный статический метод

Creates an iterator returning all but first $number elements of the given iterator.
public static skip ( Iterator $iterator, $number ) : SkippingIterator
$iterator Iterator
$number
Результат SkippingIterator

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

Copies an iterator's elements into an array.
public static toArray ( Iterator $iterator ) : array
$iterator Iterator
Результат array