Dispatcher

 class Winter\Storm\Events\Dispatcher
extends Illuminate\Events\Dispatcher

Properties

protected $firing : array

The event firing stack.

protected $sorted : array

The sorted event listeners.

Methods

public dispatch (string | object $event, array $payload = [], boolean $halt = false) : array | mixed

Fire an event and call the listeners.

Parameters
Property Description
$event
string | object
$payload
array
$halt
boolean
Returns
array | mixed

public fire (string | object $event, array $payload = [], boolean $halt = false) : array | mixed

Fire an event and call the listeners.

Parameters
Property Description
$event
string | object
$payload
array
$halt
boolean
Returns
array | mixed

public firing () : string

Get the event that is currently firing.

Returns
string

public getListeners (string $eventName) : array

Get all of the listeners for a given event name.

Parameters
Property Description
$eventName
string
Returns
array

public listen (string | array | Closure | QueuedClosure $events, mixed $listener = null, integer $priority) : void

Register an event listener with the dispatcher.

Parameters
Property Description
$events
string | array | Closure | QueuedClosure
$listener
mixed

when the third parameter is omitted and a Closure or QueuedClosure is provided this parameter is used as an integer this is used as priority value

$priority
integer
Returns
void

public makeListener (Closure | string | array $listener, boolean $wildcard = false) : Closure

Register an event listener with the dispatcher.

Parameters
Property Description
$listener
Closure | string | array
$wildcard
boolean
Returns
Closure

public until (string | object $event, array $payload = []) : array | null

Fire an event until the first non-null response is returned.

Parameters
Property Description
$event
string | object
$payload
array
Returns
array | null

protected callQueueMethodOnHandler (string $class, string $method, array $arguments) : void

Call the queue method on the handler class.

Parameters
Property Description
$class
string
$method
string
$arguments
array
Returns
void

protected cloneArgumentsForQueueing (array $arguments) : array

Clone the given arguments for queueing.

Parameters
Property Description
$arguments
array
Returns
array

protected createClassCallable (array | string $listener) : callable

Create the class based event callable.

Parameters
Property Description
$listener
array | string
Returns
callable

protected createQueuedHandlerCallable (string $class, string $method) : Closure

Create a callable for putting an event handler on the queue.

Parameters
Property Description
$class
string
$method
string
Returns
Closure

protected sortListeners (string $eventName) : void

Sort the listeners for a given event by priority.

Parameters
Property Description
$eventName
string
Returns
void
Copyright © 2024 Winter CMS