class CachingIterator extends CachingIterator implements Countable

internal  
 

Smarter caching iterator.

Properties

bool read-only $first
bool read-only $last
bool read-only $empty
bool read-only $odd
bool read-only $even
int read-only $counter
int read-only $counter0
mixed read-only $nextKey
mixed read-only $nextValue
?self read-only $parent

Methods

__construct(array|Traversable|stdClass|mixed $iterator, CachingIterator $parent = null)

No description

bool
isFirst(int $width = null)

Is the current element the first one?

bool
isLast(int $width = null)

Is the current element the last one?

bool
isEmpty()

Is the iterator empty?

bool
isOdd()

Is the counter odd?

bool
isEven()

Is the counter even?

int
getCounter()

Returns the 1-indexed counter.

int
getCounter0()

Returns the 0-indexed counter.

void
skipRound()

Decrements counter.

string
__toString()

Returns the counter as string

int
count()

Returns the count of elements.

void
next()

Forwards to the next element.

void
rewind()

Rewinds the Iterator.

mixed
getNextKey()

Returns the next key or null if position is not valid.

mixed
getNextValue()

Returns the next element or null if position is not valid.

getParent()

Returns the iterator surrounding the current one.

mixed
__get(string $name)

Returns property value.

bool
__isset(string $name)

Is property defined?

Details

at line 44
__construct(array|Traversable|stdClass|mixed $iterator, CachingIterator $parent = null)

No description

Parameters

array|Traversable|stdClass|mixed $iterator
CachingIterator $parent

at line 70
bool isFirst(int $width = null)

Is the current element the first one?

Parameters

int $width

Return Value

bool

at line 79
bool isLast(int $width = null)

Is the current element the last one?

Parameters

int $width

Return Value

bool

at line 88
bool isEmpty()

Is the iterator empty?

Return Value

bool

at line 97
bool isOdd()

Is the counter odd?

Return Value

bool

at line 106
bool isEven()

Is the counter even?

Return Value

bool

at line 115
int getCounter()

Returns the 1-indexed counter.

Return Value

int

at line 124
int getCounter0()

Returns the 0-indexed counter.

Return Value

int

at line 133
void skipRound()

Decrements counter.

Return Value

void

at line 142
string __toString()

Returns the counter as string

Return Value

string

at line 151
int count()

Returns the count of elements.

Return Value

int

at line 166
void next()

Forwards to the next element.

Return Value

void

at line 178
void rewind()

Rewinds the Iterator.

Return Value

void

at line 189
mixed getNextKey()

Returns the next key or null if position is not valid.

Return Value

mixed

at line 200
mixed getNextValue()

Returns the next element or null if position is not valid.

Return Value

mixed

at line 210
CachingIterator|null getParent()

Returns the iterator surrounding the current one.

Return Value

CachingIterator|null

at line 224
mixed __get(string $name)

Returns property value.

Parameters

string $name

Return Value

mixed

Exceptions

LogicException

at line 237
bool __isset(string $name)

Is property defined?

Parameters

string $name

Return Value

bool

Traits

Better OOP experience.