EventFake
class EventFake implements Dispatcher
Properties
protected array | $events | All of the events that have been dispatched keyed by type. |
Methods
Assert if an event was dispatched based on a truth-test callback.
Determine if an event was dispatched based on a truth-test callback.
Get all of the events matching a truth-test callback.
Determine if the given event has been dispatched.
Register an event listener with the dispatcher.
Determine if a given event has listeners.
Register an event and payload to be dispatched later.
Register an event subscriber with the dispatcher.
Flush a set of pushed events.
Fire an event and call the listeners.
Fire an event and call the listeners.
Remove a set of listeners from the dispatcher.
Forget all of the queued listeners.
Dispatch an event and call the listeners.
Details
at line 24
void
assertDispatched(string $event, callable|null $callback = null)
Assert if an event was dispatched based on a truth-test callback.
at line 39
void
assertNotDispatched(string $event, callable|null $callback = null)
Determine if an event was dispatched based on a truth-test callback.
at line 54
Collection
dispatched(string $event, callable|null $callback = null)
Get all of the events matching a truth-test callback.
at line 75
bool
hasDispatched(string $event)
Determine if the given event has been dispatched.
at line 87
void
listen(string|array $events, mixed $listener)
Register an event listener with the dispatcher.
at line 98
bool
hasListeners(string $eventName)
Determine if a given event has listeners.
at line 110
void
push(string $event, array $payload = [])
Register an event and payload to be dispatched later.
at line 121
void
subscribe(object|string $subscriber)
Register an event subscriber with the dispatcher.
at line 132
void
flush(string $event)
Flush a set of pushed events.
at line 145
array|null
fire(string|object $event, mixed $payload = [], bool $halt = false)
Fire an event and call the listeners.
at line 158
array|null
dispatch(string|object $event, mixed $payload = [], bool $halt = false)
Fire an event and call the listeners.
at line 171
void
forget(string $event)
Remove a set of listeners from the dispatcher.
at line 181
void
forgetPushed()
Forget all of the queued listeners.
at line 193
array|null
until(string|object $event, mixed $payload = [])
Dispatch an event and call the listeners.