0 follower

Final Class Yiisoft\EventDispatcher\Dispatcher\CompositeDispatcher

InheritanceYiisoft\EventDispatcher\Dispatcher\CompositeDispatcher
ImplementsPsr\EventDispatcher\EventDispatcherInterface

Delegates dispatching an event to one or more dispatchers.

Method Details

Hide inherited methods

attach() public method

public void attach ( \Psr\EventDispatcher\EventDispatcherInterface $dispatcher )
$dispatcher \Psr\EventDispatcher\EventDispatcherInterface

                public function attach(EventDispatcherInterface $dispatcher): void
{
    $this->dispatchers[] = $dispatcher;
}

            
dispatch() public method

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;
}