Documentation

ResourceIterator extends ArrayCollection
in package
implements Iterator

A generic, abstract collection class that allows collections to exhibit array functionality.

Interfaces, Classes and Traits

Iterator

Table of Contents

$defaults  : array<string|int, mixed>
$elements  : mixed
$options  : array<string|int, mixed>
$position  : int
$required  : array<string|int, mixed>
$resourceParent  : object
__construct()  : mixed
append()  : mixed
Appends a value to the container.
constructResource()  : mixed
Using a standard object, this method populates a resource model with all the object data. It does this using a whatever method the parent object has for resource creation.
count()  : int
current()  : mixed
currentElement()  : mixed
factory()  : mixed
first()  : mixed
getElement()  : mixed
getOption()  : null
getOptions()  : array<string|int, mixed>
key()  : int|mixed
Return the current position/internal pointer.
next()  : mixed
Increment the current pointer by 1, and also update the current marker.
offsetExists()  : bool
Checks to see whether a particular offset key exists.
offsetGet()  : mixed|null
Get the value for a particular offset key.
offsetSet()  : mixed
Sets a value to a particular offset.
offsetUnset()  : mixed
Unset a particular key.
rewind()  : mixed
Reset the pointer and current marker.
search()  : mixed
setElements()  : $this
setOption()  : $this
Set a particular option.
setOptions()  : $this
setResourceParent()  : $this
sort()  : mixed
valid()  : bool
This method is called after self::rewind() and self::next() to check if the current position is valid.
valueExists()  : bool
Checks to see whether a particular value exists.
parseOptions()  : mixed

Properties

$defaults

protected array<string|int, mixed> $defaults = array('limit.total' => 1000)

Fallback defaults if options are not explicitly set or provided.

$options

protected array<string|int, mixed> $options

The options for this iterator.

$position

protected int $position

Internal pointer of the iterator - reveals its current position.

$required

protected array<string|int, mixed> $required = array()

Required options

$resourceParent

protected object $resourceParent

The parent object which resource models are instantiated from. The parent needs to have appropriate methods to instantiate the particular object.

Methods

__construct()

public __construct([mixed $data = array() ]) : mixed
Parameters
$data : mixed = array()
Return values
mixed

append()

Appends a value to the container.

public append( $value) : mixed
Parameters
$value :
Return values
mixed

constructResource()

Using a standard object, this method populates a resource model with all the object data. It does this using a whatever method the parent object has for resource creation.

public constructResource( $object) : mixed
Parameters
$object :

Standard object

Tags
throws
CollectionException
Return values
mixed

currentElement()

public currentElement() : mixed
Return values
mixed

factory()

public static factory(mixed $parent[, array<string|int, mixed> $options = array() ][, array<string|int, mixed> $data = array() ]) : mixed
Parameters
$parent : mixed
$options : array<string|int, mixed> = array()
$data : array<string|int, mixed> = array()
Return values
mixed

getElement()

public getElement(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed

getOption()

public getOption( $key) : null
Parameters
$key :
Return values
null

getOptions()

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Options for the resource iterator.

key()

Return the current position/internal pointer.

public key() : int|mixed
Return values
int|mixed

next()

Increment the current pointer by 1, and also update the current marker.

public next() : mixed
Return values
mixed

offsetExists()

Checks to see whether a particular offset key exists.

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

Get the value for a particular offset key.

public offsetGet(mixed $offset) : mixed|null
Parameters
$offset : mixed
Return values
mixed|null

offsetSet()

Sets a value to a particular offset.

public offsetSet(mixed $offset, mixed $value) : mixed
Parameters
$offset : mixed
$value : mixed
Return values
mixed

offsetUnset()

Unset a particular key.

public offsetUnset(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed

rewind()

Reset the pointer and current marker.

public rewind() : mixed
Return values
mixed
public search(mixed $callback) : mixed
Parameters
$callback : mixed
Return values
mixed

setElements()

public setElements([array<string|int, mixed> $data = array() ]) : $this
Parameters
$data : array<string|int, mixed> = array()
Return values
$this

setOption()

Set a particular option.

public setOption( $key,  $value) : $this
Parameters
$key :
$value :
Return values
$this

setOptions()

public setOptions(array<string|int, mixed> $options) : $this
Parameters
$options : array<string|int, mixed>
Return values
$this

setResourceParent()

public setResourceParent( $parent) : $this
Parameters
$parent :
Return values
$this

sort()

public sort() : mixed
Tags
todo

Implement

Return values
mixed

valid()

This method is called after self::rewind() and self::next() to check if the current position is valid.

public valid() : bool
Return values
bool

valueExists()

Checks to see whether a particular value exists.

public valueExists( $value) : bool
Parameters
$value :
Return values
bool

parseOptions()

protected parseOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>
Return values
mixed

Search results