Fork me on Github

Class CalendR\Event\Collection\ Indexed

This class store event by indexing them with a given index pattern.

Index pattern is generated by an index function.


Implements: CollectionInterface

Methods

__construct( array $events = array(), callable| null $callable = null)

add( EventInterface $event)

Adds an event to the collection

remove( EventInterface $event)

Removes an event from the collection

bool has( mixed $index)

Returns if we have events for the given index

array<EventInterface> find( mixed $index)

returns events

array<EventInterface> all()

Returns a flattened array of all events

count()

Details

public __construct( array $events = array(), callable| null $callable = null)

Parameters
array $events
callable| null $callable

public add( EventInterface $event)

Adds an event to the collection

Parameters
EventInterface $event

public remove( EventInterface $event)

Removes an event from the collection

Parameters
EventInterface $event

public bool has( mixed $index)

Returns if we have events for the given index

Parameters
mixed $index
Return Value
bool

public array<EventInterface> find( mixed $index)

returns events

Parameters
mixed $index
Return Value
array<EventInterface>

public array<EventInterface> all()

Returns a flattened array of all events

Return Value
array<EventInterface>

public count()