Iterator

Namespace

Table of Contents

Classes

ChainIterableIterator

An iterator that chains multiple iterable sources together into a single unified iterator.

ChunkedIteratorAggregate

Splits an iterable into fixed-size chunks.

ClosureFactoryIteratorAggregate

Provides an iterator implementation based on a closure factory.

ClosureIteratorIterator

An extended IteratorIterator that applies a closure transformation to each element during iteration.

ConsecutiveGroupIterator

Groups elements dynamically based on a user-defined condition.

CountableFilterIterator

Provides a filter iterator implementation that is also countable.

CountableIterator

Provides a base iterator implementation that is also countable.

CountableIteratorAggregate

Provides a base implementation for iterator aggregate objects that are also countable.

CountableIteratorIterator

Provides an iterator wrapper that is also countable.

FileExtensionFilterIterator

A filter iterator that only accepts files matching specified extensions.

GeneratorCachingIteratorAggregate

A caching iterator aggregate designed to wrap a generator and cache its results.

GeneratorRewindableIterator

An iterator that allows rewinding over a generator by caching its values.

GroupByIteratorIterator

Groups elements from an iterator based on a callback function.

InterleaveIteratorIterator

Interleaves elements from multiple iterators in a round-robin fashion.

IterableIterator

A normalized iterator wrapper that ensures any iterable (array or Traversable) is treated as a standard \Iterator.

LookaheadIterator

An iterator that allows peeking at the next value(s) and stepping back to the previous value(s) without advancing the iteration.

RangeIterator

An iterator that behaves like PHP's `range()` function.

RepeatableIteratorIterator

An iterator that enables repeated iteration over a finite subset of an infinite iterator.

SlidingWindowIteratorIterator

Provides a sliding window over an iterator with sequential keys.

TrimIteratorIterator

An iterator that trims each value within a `iterable`.

UniqueIteratorIterator

Filters duplicate values from an iterator, ensuring uniqueness.

ZipIteratorIterator

Combines multiple iterators into a single iterator, returning arrays of grouped values.

Traits

CountableIteratorIteratorTrait

Provides counting behavior for iterators and iterator aggregates.

Functions

debugIterable()

Prints a debug representation of an iterable object.

 : void
Functions

Functions

debugIterable()

Prints a debug representation of an iterable object.

debugIterable( iterable<string|int, mixed>  $iterable[, string|null  $section = null]) : void

Description

This function iterates over a Traversable object and prints each key-value pair, along with an optional section title. If no section title is provided, the function uses the class name of the iterable object.

Example Usage:

Parameters
$iterable : iterable<string|int, mixed>

Description

the iterable object to debug

$section : string|null = null

Description

an optional title for the output section

Tags
example

Description

use FastForward\Iterator\debugIterable;
use ArrayIterator;

$iterator = new ArrayIterator(['a' => 1, 'b' => 2, 'c' => 3]);

debugIterable($iterator, 'Example Output');

Output:

=== Example Output ===

Length: 3
Output: [
  "a" => 1,
  "b" => 2,
  0 => 3,
]