-
-
Notifications
You must be signed in to change notification settings - Fork 0
ZipIteratorIterator
Combines multiple iterators into a single iterator, returning arrays of grouped values.
This iterator synchronously iterates over multiple traversable sources, yielding an array where each element corresponds to the current value of each source. The iteration stops when the shortest iterator is exhausted.
- Full name:
\FastForward\Iterator\ZipIteratorIterator - Parent class:
\FastForward\Iterator\CountableIterator
Initializes the ZipIteratorIterator.
public __construct(iterable $iterators): mixedParameters:
| Parameter | Type | Description |
|---|---|---|
$iterators |
iterable | The iterators to be combined. |
Throws:
if fewer than two iterators are provided
Retrieves the current set of values from each iterator.
public current(): array<int,mixed>Return Value:
the array of current values from each iterator
Retrieves the current key (index) of the iteration.
public key(): intReturn Value:
the current index
Moves to the next set of values in each iterator.
public next(): voidChecks if all iterators still have valid elements.
public valid(): boolThe iteration stops when the shortest iterator is exhausted.
Return Value:
true if valid elements exist, false otherwise
Resets the iterator to the beginning.
public rewind(): voidCounts the number of elements available in the iterator.
public count(): intThis method MUST count the elements by iterating over a clone of the current iterator instance so that the active iterator state of the original object is not modified during the counting process. Concrete implementations SHOULD therefore remain safely cloneable whenever this behavior is expected to be used.
Return Value:
the total number of elements exposed by the iterator