TuiEvent
One event published on a {@see \Milpa\Live\Contracts\Tui\TuiEventBusInterface}. `$type` is the dispatch key listeners subscribe by (e.g. `'job.started'`); event type naming is a bus-wide convention, not enforced by this class.
TuiEvent::__construct()
public function __construct(string $type, array $payload = [], ?string $source = null, float $time = 0):Parameters
| Name | Type | Description |
|---|---|---|
| $type | string | The event type, used for subscriber dispatch; MUST NOT be empty. |
| $payload | array<string, mixed> | Event-specific data. |
| $source | (string | null) | The component/subsystem that published this event, if identified. |
| $time | float | Unix timestamp (with microsecond precision) the event occurred at; `0.0` unless set via {@see now()}. |
Throws
\InvalidArgumentException If `$type` is empty.
TuiEvent::now()
public static function now(string $type, array $payload = [], ?string $source = null): selfBuilds an event timestamped with the current time ({@see microtime()}), for the common case of publishing an event as it happens.
Parameters
| Name | Type | Description |
|---|---|---|
| $type | string | |
| $payload | array<string, mixed> | |
| $source | ?string |