Final Class Yiisoft\EventDispatcher\Dispatcher\CompositeDispatcher
| Inheritance | Yiisoft\EventDispatcher\Dispatcher\CompositeDispatcher |
|---|---|
| Implements | Psr\EventDispatcher\EventDispatcherInterface |
Delegates dispatching an event to one or more dispatchers.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| attach() | Yiisoft\EventDispatcher\Dispatcher\CompositeDispatcher | |
| dispatch() | Yiisoft\EventDispatcher\Dispatcher\CompositeDispatcher |
Method Details
| public void attach ( \Psr\EventDispatcher\EventDispatcherInterface $dispatcher ) | ||
| $dispatcher | \Psr\EventDispatcher\EventDispatcherInterface | |
public function attach(EventDispatcherInterface $dispatcher): void
{
$this->dispatchers[] = $dispatcher;
}
| public mixed dispatch ( object $event ) | ||
| $event | object | |
public function dispatch(object $event)
{
foreach ($this->dispatchers as $dispatcher) {
if ($event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
return $event;
}
$event = $dispatcher->dispatch($event);
}
return $event;
}
Signup or Login in order to comment.