Skip to content
docsv0.12.0

DeclaredEvents

A dispatcher that knows which events were DECLARED to it and which names it has DISPATCHED. The one place every dispatch passes through is the dispatcher, so it is the one authority on «what events exist» (greenhouse decisions/0228): emitters declare their events where they hold the dispatcher, the dispatcher remembers every name it actually dispatched in this process, and a catalogue reads both — what was declared, and what was dispatched without a declaration, as debt with a name. This is a separate contract, not a widening of {@see MilpaEventDispatcherInterface}: a dispatcher that does not implement it is asked nothing, and whoever asks says so instead of answering «no events».

DeclaredEvents::declare()

abstract public function declare(Milpa\Interfaces\Event\EventDeclaration ...$events): void

Registers what an emitter dispatches. Declaring the same name twice keeps the first declaration.

Parameters

Parameters of declare()
NameTypeDescription
$eventsMilpa\Interfaces\Event\EventDeclaration

DeclaredEvents::declared()

abstract public function declared(): array

Every declaration made to this dispatcher, in declaration order.

DeclaredEvents::dispatched()

abstract public function dispatched(): array

Every event name this dispatcher has dispatched in this process, first occurrence first.