Class: DebugEventBus
Full name: Clarity\Debug\DebugEventBus
Passes debug events to listeners and keeps emitted events in memory, available through getEvents(). A listener is a DebugListener or any callable.
Only the most recent $maxEvents events are kept; older ones are dropped.
Public methods
__construct() ·
public function __construct(int $maxEvents = 1000): mixed
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$maxEvents |
int | 1000 |
Return value
- Type:
mixed
subscribe() ·
public function subscribe(Clarity\Debug\DebugListener|callable $listener): void
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$listener |
DebugListener|callable | - |
Return value
- Type:
void
emit() ·
public function emit(string $type, array $payload = []): void
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$type |
string | - | |
$payload |
array | [] |
Return value
- Type:
void
getEvents() ·
public function getEvents(): array
Return value
- Type:
array