DispatcherMailerTest
extends Dispatcher
in package
Table of Contents
- $container : Container
- The IoC container instance.
- $listeners : array<string|int, mixed>
- The registered event listeners.
- $queueResolver : callable
- The queue resolver instance.
- $wildcards : array<string|int, mixed>
- The wildcard listeners.
- __construct() : void
- Create a new event dispatcher instance.
- createClassListener() : Closure
- Create a class based listener using the IoC container.
- dispatch() : array<string|int, mixed>|null
- Fire an event and call the listeners.
- fire() : array<string|int, mixed>|null
- Fire an event and call the listeners.
- flush() : void
- Flush a set of pushed events.
- forget() : void
- Remove a set of listeners from the dispatcher.
- forgetPushed() : void
- Forget all of the pushed listeners.
- getListeners() : array<string|int, mixed>
- Get all of the listeners for a given event name.
- hasListeners() : bool
- Determine if a given event has listeners.
- listen() : void
- Register an event listener with the dispatcher.
- makeListener() : Closure
- Register an event listener with the dispatcher.
- push() : void
- Register an event and payload to be fired later.
- setQueueResolver() : $this
- Set the queue resolver implementation.
- subscribe() : void
- Register an event subscriber with the dispatcher.
- until() : array<string|int, mixed>|null
- Fire an event until the first non-null response is returned.
- addInterfaceListeners() : array<string|int, mixed>
- Add the listeners for the event's interfaces to the given array.
- broadcastEvent() : void
- Broadcast the given event class.
- broadcastWhen() : bool
- Check if event should be broadcasted by condition.
- createClassCallable() : callable
- Create the class based event callable.
- createListenerAndJob() : array<string|int, mixed>
- Create the listener and job for a queued listener.
- createQueuedHandlerCallable() : Closure
- Create a callable for putting an event handler on the queue.
- getWildcardListeners() : array<string|int, mixed>
- Get the wildcard listeners for the event.
- handlerShouldBeQueued() : bool
- Determine if the event handler class should be queued.
- handlerWantsToBeQueued() : bool
- Determine if the event handler wants to be queued.
- parseClassCallable() : array<string|int, mixed>
- Parse the class listener into class and method.
- parseEventAndPayload() : array<string|int, mixed>
- Parse the given event and payload and prepare them for dispatching.
- propagateListenerOptions() : mixed
- Propagate listener options to the job.
- queueHandler() : void
- Queue the handler class.
- resolveQueue() : Queue
- Get the queue implementation from the resolver.
- resolveSubscriber() : mixed
- Resolve the subscriber instance.
- setupWildcardListen() : void
- Setup a wildcard listener callback.
- shouldBroadcast() : bool
- Determine if the payload has a broadcastable event.
Properties
$container
The IoC container instance.
protected
Container
$container
$listeners
The registered event listeners.
protected
array<string|int, mixed>
$listeners
= []
$queueResolver
The queue resolver instance.
protected
callable
$queueResolver
$wildcards
The wildcard listeners.
protected
array<string|int, mixed>
$wildcards
= []
Methods
__construct()
Create a new event dispatcher instance.
public
__construct() : void
Return values
void —createClassListener()
Create a class based listener using the IoC container.
public
createClassListener(string $listener[, bool $wildcard = false ]) : Closure
Parameters
- $listener : string
- $wildcard : bool = false
Return values
Closure —dispatch()
Fire an event and call the listeners.
public
dispatch(string|object $event[, mixed $payload = [] ][, bool $halt = false ]) : array<string|int, mixed>|null
Parameters
- $event : string|object
- $payload : mixed = []
- $halt : bool = false
Return values
array<string|int, mixed>|null —fire()
Fire an event and call the listeners.
public
fire(string|object $event[, mixed $payload = [] ][, bool $halt = false ]) : array<string|int, mixed>|null
Parameters
- $event : string|object
- $payload : mixed = []
- $halt : bool = false
Return values
array<string|int, mixed>|null —flush()
Flush a set of pushed events.
public
flush(string $event) : void
Parameters
- $event : string
Return values
void —forget()
Remove a set of listeners from the dispatcher.
public
forget(string $event) : void
Parameters
- $event : string
Return values
void —forgetPushed()
Forget all of the pushed listeners.
public
forgetPushed() : void
Return values
void —getListeners()
Get all of the listeners for a given event name.
public
getListeners(string $eventName) : array<string|int, mixed>
Parameters
- $eventName : string
Return values
array<string|int, mixed> —hasListeners()
Determine if a given event has listeners.
public
hasListeners(string $eventName) : bool
Parameters
- $eventName : string
Return values
bool —listen()
Register an event listener with the dispatcher.
public
listen(string|array<string|int, mixed> $events, mixed $listener) : void
Parameters
- $events : string|array<string|int, mixed>
- $listener : mixed
Return values
void —makeListener()
Register an event listener with the dispatcher.
public
makeListener(Closure|string $listener[, bool $wildcard = false ]) : Closure
Parameters
- $listener : Closure|string
- $wildcard : bool = false
Return values
Closure —push()
Register an event and payload to be fired later.
public
push(string $event[, array<string|int, mixed> $payload = [] ]) : void
Parameters
- $event : string
- $payload : array<string|int, mixed> = []
Return values
void —setQueueResolver()
Set the queue resolver implementation.
public
setQueueResolver(callable $resolver) : $this
Parameters
- $resolver : callable
Return values
$this —subscribe()
Register an event subscriber with the dispatcher.
public
subscribe(object|string $subscriber) : void
Parameters
- $subscriber : object|string
Return values
void —until()
Fire an event until the first non-null response is returned.
public
until(string|object $event[, mixed $payload = [] ]) : array<string|int, mixed>|null
Parameters
- $event : string|object
- $payload : mixed = []
Return values
array<string|int, mixed>|null —addInterfaceListeners()
Add the listeners for the event's interfaces to the given array.
protected
addInterfaceListeners(string $eventName[, array<string|int, mixed> $listeners = [] ]) : array<string|int, mixed>
Parameters
- $eventName : string
- $listeners : array<string|int, mixed> = []
Return values
array<string|int, mixed> —broadcastEvent()
Broadcast the given event class.
protected
broadcastEvent(ShouldBroadcast $event) : void
Parameters
- $event : ShouldBroadcast
Return values
void —broadcastWhen()
Check if event should be broadcasted by condition.
protected
broadcastWhen(mixed $event) : bool
Parameters
- $event : mixed
Return values
bool —createClassCallable()
Create the class based event callable.
protected
createClassCallable(string $listener) : callable
Parameters
- $listener : string
Return values
callable —createListenerAndJob()
Create the listener and job for a queued listener.
protected
createListenerAndJob(string $class, string $method, array<string|int, mixed> $arguments) : array<string|int, mixed>
Parameters
- $class : string
- $method : string
- $arguments : array<string|int, mixed>
Return values
array<string|int, mixed> —createQueuedHandlerCallable()
Create a callable for putting an event handler on the queue.
protected
createQueuedHandlerCallable(string $class, string $method) : Closure
Parameters
- $class : string
- $method : string
Return values
Closure —getWildcardListeners()
Get the wildcard listeners for the event.
protected
getWildcardListeners(string $eventName) : array<string|int, mixed>
Parameters
- $eventName : string
Return values
array<string|int, mixed> —handlerShouldBeQueued()
Determine if the event handler class should be queued.
protected
handlerShouldBeQueued(string $class) : bool
Parameters
- $class : string
Return values
bool —handlerWantsToBeQueued()
Determine if the event handler wants to be queued.
protected
handlerWantsToBeQueued(string $class, array<string|int, mixed> $arguments) : bool
Parameters
- $class : string
- $arguments : array<string|int, mixed>
Return values
bool —parseClassCallable()
Parse the class listener into class and method.
protected
parseClassCallable(string $listener) : array<string|int, mixed>
Parameters
- $listener : string
Return values
array<string|int, mixed> —parseEventAndPayload()
Parse the given event and payload and prepare them for dispatching.
protected
parseEventAndPayload(mixed $event, mixed $payload) : array<string|int, mixed>
Parameters
- $event : mixed
- $payload : mixed
Return values
array<string|int, mixed> —propagateListenerOptions()
Propagate listener options to the job.
protected
propagateListenerOptions(mixed $listener, mixed $job) : mixed
Parameters
- $listener : mixed
- $job : mixed
Return values
mixed —queueHandler()
Queue the handler class.
protected
queueHandler(string $class, string $method, array<string|int, mixed> $arguments) : void
Parameters
- $class : string
- $method : string
- $arguments : array<string|int, mixed>
Return values
void —resolveQueue()
Get the queue implementation from the resolver.
protected
resolveQueue() : Queue
Return values
Queue —resolveSubscriber()
Resolve the subscriber instance.
protected
resolveSubscriber(object|string $subscriber) : mixed
Parameters
- $subscriber : object|string
Return values
mixed —setupWildcardListen()
Setup a wildcard listener callback.
protected
setupWildcardListen(string $event, mixed $listener) : void
Parameters
- $event : string
- $listener : mixed
Return values
void —shouldBroadcast()
Determine if the payload has a broadcastable event.
protected
shouldBroadcast(array<string|int, mixed> $payload) : bool
Parameters
- $payload : array<string|int, mixed>