Final Class Yiisoft\EventDispatcher\Dispatcher\Dispatcher
| Inheritance | Yiisoft\ |
|---|---|
| Implements | Psr\ |
Dispatcher executes listeners attached to event passed.
See also https://www.php-fig.org/psr/psr-14/.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ |
|
| dispatch() | Yiisoft\ |
Method Details
| public mixed __construct ( \ | ||
| $listenerProvider | \ |
|
public function __construct(private ListenerProviderInterface $listenerProvider) {}
| public object dispatch ( object $event ) | ||
| $event | object | |
public function dispatch(object $event): object
{
/** @var callable $listener */
foreach ($this->listenerProvider->getListenersForEvent($event) as $listener) {
if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
return $event;
}
$spoofableEvent = $event;
$listener($spoofableEvent);
}
return $event;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.