KeyListIterator
in package
implements
IteratorInterface, Countable
Interfaces, Classes, Traits and Enums
- IteratorInterface
- Countable
Table of Contents
- $count : int
- Number of keys
- $keys : array<string|int, string>
- Keys to iterate over
- $mode : int
- The iterator mode
- $position : int
- Current iterator position
- $storage : StorageInterface
- The storage instance
- __construct() : mixed
- Constructor
- count() : int
- Count number of items
- current() : mixed
- Get current key, value or metadata.
- getMode() : int
- Get iterator mode
- getStorage() : StorageInterface
- Get storage instance
- key() : string
- Get current key
- next() : void
- Move forward to next element
- rewind() : void
- Rewind the Iterator to the first element.
- setMode() : KeyListIterator
- Set iterator mode
- valid() : bool
- Checks if current position is valid
Properties
$count
Number of keys
protected
int
$count
$keys
Keys to iterate over
protected
array<string|int, string>
$keys
$mode
The iterator mode
protected
int
$mode
= \Zend\Cache\Storage\IteratorInterface::CURRENT_AS_KEY
$position
Current iterator position
protected
int
$position
= 0
$storage
The storage instance
protected
StorageInterface
$storage
Methods
__construct()
Constructor
public
__construct(StorageInterface $storage, array<string|int, mixed> $keys) : mixed
Parameters
- $storage : StorageInterface
- $keys : array<string|int, mixed>
Return values
mixed —count()
Count number of items
public
count() : int
Return values
int —current()
Get current key, value or metadata.
public
current() : mixed
Return values
mixed —getMode()
Get iterator mode
public
getMode() : int
Return values
int —Value of IteratorInterface::CURRENT_AS_*
getStorage()
Get storage instance
public
getStorage() : StorageInterface
Return values
StorageInterface —key()
Get current key
public
key() : string
Return values
string —next()
Move forward to next element
public
next() : void
Return values
void —rewind()
Rewind the Iterator to the first element.
public
rewind() : void
Return values
void —setMode()
Set iterator mode
public
setMode(int $mode) : KeyListIterator
Parameters
- $mode : int
Return values
KeyListIterator —Provides a fluent interface
valid()
Checks if current position is valid
public
valid() : bool