PriorityDispatcher is a global event emitter with priority assignment.

Protected Properties

protected Illuminate\Contracts\Container\Container $container

container for IoC

protected DispatcherContract $laravelEvents

laravelEvents instance.

protected array $emitterSingleEventCollection

emitterSingleEventCollection of events to be fired once only

protected array $emitterEventCollection

emitterEventCollection of all registered events

protected array $emitterEventSorted

emitterEventSorted collection

Public Methods

public __call()

public __call(string $method, array $parameters): mixed 

__call magic

public __construct()

public __construct(
    Illuminate\Contracts\Container\Container|null $container = null
): void 

__construct a new event dispatcher instance.

public bindEvent()

public bindEvent($event, $callback, $priority = 0): void 

bindEvent creates a new event binding

public bindEventOnce()

public bindEventOnce($event, $callback, $priority = 0): void 

bindEventOnce creates a new event binding that fires once only

public fire()

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

fire an event and call the listeners.

public fireEvent()

public fireEvent(
    string $event,
    array $params = [],
    boolean $halt = false
): array 

fireEvent inherits logic from the Emitter, modified to forward call to Laravel events

public forget()

public forget(string $event): void 

forget removes a set of listeners from the dispatcher.

public getLaravelDispatcher()

public getLaravelDispatcher(): Illuminate\Contracts\Events\Dispatcher 

getLaravelDispatcher returns the base event resolver.

public listen()

public listen(
    string|array $events,
    mixed|null $listener = null,
    int $priority = 0
): void 

listen registers an event listener with the dispatcher.

public listenOnce()

public listenOnce(
    string|array $events,
    callable $listener,
    int $priority = 0
): void 

listenOnce registers an event that only fires once.

public setLaravelDispatcher()

public setLaravelDispatcher(
): October\Rain\Events\PriorityDispatcher 

setLaravelDispatcher sets the event resolver implementation.

public unbindEvent()

public unbindEvent($event = null): void 

unbindEvent destroys an event binding

Protected Methods

protected createClassCallback()

protected createClassCallback($callback): void

createClassCallback passes what is usually a static method call through the IoC container to create a callable instance.

protected emitterEventSortEvents()

protected emitterEventSortEvents($eventName, $combined = []): array 

emitterEventSortEvents sorts the listeners for a given event by priority

protected forwardCallTo()

protected forwardCallTo(
    mixed $object,
    string $method,
    array $parameters
): mixed 

Forward a method call to the given object.

protected forwardDecoratedCallTo()

protected forwardDecoratedCallTo(
    mixed $object,
    string $method,
    array $parameters
): mixed 

Forward a method call to the given object, returning $this if the forwarded call returned itself.

protected static throwBadMethodCallException()

protected static throwBadMethodCallException(string $method): void 

Throw a bad method call exception for the given method.