EDM SDK

Collection
in package
implements Iterator, ArrayAccess, Serializable, Countable

Interfaces, Classes and Traits

Iterator
ArrayAccess
Serializable
Countable

Table of Contents

__construct()  : mixed
count()  : int
Returns the amount of elements in the stream.
current()  : array<string|int, mixed>
Returns the current item of the collection.
hasItems()  : bool
Checks if the collection contains any elements.
key()  : int
Returns the index of the current item.
next()  : mixed
Moves forward to the next item.
offsetExists()  : bool
Supports array access and checks for offset existence.
offsetGet()  : array<string|int, mixed>
Supports array access and returns an item at a given offset
offsetSet()  : mixed
Not supported for collections (array access)
offsetUnset()  : mixed
Not supported for collections (array access)
rewind()  : mixed
Rewinds the item iterator to the first item.
serialize()  : string
Returns the JSON representation of the collection and its elements.
toArray()  : array<string|int, mixed>
Returns an array copy of this collection.
unserialize()  : Collection
Populates the collection and its elements based on a JSON string.
valid()  : bool
Checks if the current iterator position is valid.

Methods

__construct()

public __construct([string $json = null ]) : mixed
Parameters
$json : string = null
Return values
mixed

count()

Returns the amount of elements in the stream.

public count() : int
Return values
int

Number of elements

current()

Returns the current item of the collection.

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

The item

hasItems()

Checks if the collection contains any elements.

public hasItems() : bool
Return values
bool

True if collection has at least one element

key()

Returns the index of the current item.

public key() : int
Return values
int

Index of current item

next()

Moves forward to the next item.

public next() : mixed
Return values
mixed

offsetExists()

Supports array access and checks for offset existence.

public offsetExists(int $offset) : bool
Parameters
$offset : int

The offset to check

Return values
bool

True if given offset exists in the collection

offsetGet()

Supports array access and returns an item at a given offset

public offsetGet(int $offset) : array<string|int, mixed>
Parameters
$offset : int

The offset to check

Return values
array<string|int, mixed>

The item or null, if offset is invalid

offsetSet()

Not supported for collections (array access)

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

offsetUnset()

Not supported for collections (array access)

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

rewind()

Rewinds the item iterator to the first item.

public rewind() : mixed
Return values
mixed

serialize()

Returns the JSON representation of the collection and its elements.

public serialize() : string
Return values
string

The JSON encoded stream

toArray()

Returns an array copy of this collection.

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

The array copy holding all data

unserialize()

Populates the collection and its elements based on a JSON string.

public unserialize(string $json) : Collection
Parameters
$json : string

JSON string to populate collection with

Tags
throws
UnexpectedValueException

if JSON unserializes to unexpected value.

throws
InvalidArgumentException

if JSON is not valid

Return values
Collection

valid()

Checks if the current iterator position is valid.

public valid() : bool
Return values
bool

True if current iterator position is valid

Search results