Dispatcher
class Dispatcher implements Dispatcher (View source)
Properties
protected Container | $container | The IoC container instance. | |
protected array | $listeners | The registered event listeners. | |
protected array | $wildcards | The wildcard listeners. | |
protected array | $sorted | The sorted event listeners. | |
protected array | $firing | The event firing stack. | |
protected callable | $queueResolver | The queue resolver instance. |
Methods
void | __construct(Container $container = null) Create a new event dispatcher instance. | |
void | listen(string|array $events, mixed $listener, int $priority) Register an event listener with the dispatcher. | |
void | setupWildcardListen(string $event, mixed $listener) Setup a wildcard listener callback. | |
bool | hasListeners(string $eventName) Determine if a given event has listeners. | |
void | push(string $event, array $payload = []) Register an event and payload to be fired later. | |
void | subscribe(object|string $subscriber) Register an event subscriber with the dispatcher. | |
mixed | resolveSubscriber(object|string $subscriber) Resolve the subscriber instance. | |
mixed | until(string $event, array $payload = []) Fire an event until the first non-null response is returned. | |
void | flush(string $event) Flush a set of pushed events. | |
string | firing() Get the event that is currently firing. | |
array|null | fire(string|object $event, mixed $payload = [], bool $halt = false) Fire an event and call the listeners. | |
void | broadcastEvent(ShouldBroadcast $event) Broadcast the given event class. | |
array | getListeners(string $eventName) Get all of the listeners for a given event name. | |
array | getWildcardListeners(string $eventName) Get the wildcard listeners for the event. | |
void | sortListeners(string $eventName) Sort the listeners for a given event by priority. | |
mixed | makeListener(mixed $listener) Register an event listener with the dispatcher. | |
Closure | createClassListener(mixed $listener) Create a class based listener using the IoC container. | |
callable | createClassCallable(string $listener, Container $container) Create the class based event callable. | |
array | parseClassCallable(string $listener) Parse the class listener into class and method. | |
bool | handlerShouldBeQueued(string $class) Determine if the event handler class should be queued. | |
Closure | createQueuedHandlerCallable(string $class, string $method) Create a callable for putting an event handler on the queue. | |
array | cloneArgumentsForQueueing(array $arguments) Clone the given arguments for queueing. | |
void | callQueueMethodOnHandler(string $class, string $method, array $arguments) Call the queue method on the handler class. | |
void | forget(string $event) Remove a set of listeners from the dispatcher. | |
void | forgetPushed() Forget all of the pushed listeners. | |
Queue | resolveQueue() Get the queue implementation from the resolver. | |
$this | setQueueResolver(callable $resolver) Set the queue resolver implementation. |
Details
void __construct(Container $container = null)
Create a new event dispatcher instance.
void listen(string|array $events, mixed $listener, int $priority)
Register an event listener with the dispatcher.
protected void setupWildcardListen(string $event, mixed $listener)
Setup a wildcard listener callback.
bool hasListeners(string $eventName)
Determine if a given event has listeners.
void push(string $event, array $payload = [])
Register an event and payload to be fired later.
void subscribe(object|string $subscriber)
Register an event subscriber with the dispatcher.
protected mixed resolveSubscriber(object|string $subscriber)
Resolve the subscriber instance.
mixed until(string $event, array $payload = [])
Fire an event until the first non-null response is returned.
void flush(string $event)
Flush a set of pushed events.
string firing()
Get the event that is currently firing.
array|null fire(string|object $event, mixed $payload = [], bool $halt = false)
Fire an event and call the listeners.
protected void broadcastEvent(ShouldBroadcast $event)
Broadcast the given event class.
array getListeners(string $eventName)
Get all of the listeners for a given event name.
protected array getWildcardListeners(string $eventName)
Get the wildcard listeners for the event.
protected void sortListeners(string $eventName)
Sort the listeners for a given event by priority.
mixed makeListener(mixed $listener)
Register an event listener with the dispatcher.
Closure createClassListener(mixed $listener)
Create a class based listener using the IoC container.
protected callable createClassCallable(string $listener, Container $container)
Create the class based event callable.
protected array parseClassCallable(string $listener)
Parse the class listener into class and method.
protected bool handlerShouldBeQueued(string $class)
Determine if the event handler class should be queued.
protected Closure createQueuedHandlerCallable(string $class, string $method)
Create a callable for putting an event handler on the queue.
protected array cloneArgumentsForQueueing(array $arguments)
Clone the given arguments for queueing.
protected void callQueueMethodOnHandler(string $class, string $method, array $arguments)
Call the queue method on the handler class.
void forget(string $event)
Remove a set of listeners from the dispatcher.
void forgetPushed()
Forget all of the pushed listeners.
protected Queue resolveQueue()
Get the queue implementation from the resolver.
$this setQueueResolver(callable $resolver)
Set the queue resolver implementation.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.3/Illuminate/Events/Dispatcher.html