class DtionList implements Countable

This class stores a list of Dtion, allowing the user to find() the corresponding Dtion (therefor the result) among multiple conditions.

Properties

protected Dtionable[] $container

Internal container

Methods

void
__construct(Dtionable[]|null $dtions = null)

Construct an empty Dtion

static DtionList
make(Dtionable[]|null $dtions = null)

Static mode to instanciate a Dtion

void
push(Dtionable $dtion)

Push a Dtion to the list.

Dtionable|null
find(mixed $criterion)

Find the first dtion to match $critera, and returns it or null otherwise.

mixed
resultFor(mixed $criterion)

Find the first dtion to match $critera, and returns it's result.

static DtionList
fromArray(array $data)

Instanciate from array of arrays, given by self::toArray() method

toArray()

No description

int
count()

No description

array
__serialize()

This method defines a serialization-friendly arbitrary representation of the object in form of an array.

void
__unserialize(array $dtions)

This method is passed the restored array that was returned from __serialize(). It may then restore the properties of the object from that array as appropriate.

Details

at line 31
void __construct(Dtionable[]|null $dtions = null)

Construct an empty Dtion

Parameters

Dtionable[]|null $dtions

One or multiple dtions to add to the list.

Return Value

void

at line 52
static DtionList make(Dtionable[]|null $dtions = null)

Static mode to instanciate a Dtion

Parameters

Dtionable[]|null $dtions

One or multiple dtions to add to the list.

Return Value

DtionList

See also

\Dtion\Dtion::__construct()

at line 64
void push(Dtionable $dtion)

Push a Dtion to the list.

Parameters

Dtionable $dtion

Return Value

void

at line 76
Dtionable|null find(mixed $criterion)

Find the first dtion to match $critera, and returns it or null otherwise.

Parameters

mixed $criterion

Return Value

Dtionable|null

at line 96
mixed resultFor(mixed $criterion)

Find the first dtion to match $critera, and returns it's result.

Parameters

mixed $criterion

Return Value

mixed

Exceptions

CriterionDoesntMatchException

at line 113
static DtionList fromArray(array $data)

Instanciate from array of arrays, given by self::toArray() method

Parameters

array $data

Return Value

DtionList

at line 125
toArray()

No description

at line 137
int count()

No description

Return Value

int

at line 148
array __serialize()

This method defines a serialization-friendly arbitrary representation of the object in form of an array.

Return Value

array

at line 162
void __unserialize(array $dtions)

This method is passed the restored array that was returned from __serialize(). It may then restore the properties of the object from that array as appropriate.

Parameters

array $dtions

Return Value

void