/** * {@inheritdoc} */ protected function doDispatch($listeners, $eventName, Event $event) { foreach ($listeners as $listener) { if ($event->isPropagationStopped()) { break; } $this->currentListenerSniffCodeProvider->setCurrentListener($listener); call_user_func($listener, $event, $eventName, $this); } }
protected function brocast(Event $event) { $eventName = $event->getName(); $listeners = []; foreach ($this->events[$eventName] as &$eventGroup) { foreach ($eventGroup as $listenerArray) { list($listener, $priority) = $listenerArray; $listeners[$priority][] = $listener; } } krsort($listeners); $processCount = 0; foreach ($listeners as $listener) { foreach ($listener as $callback) { if ($event && $event->isPropagationStopped()) { return $processCount; } $callback($event); $processCount++; } } return $processCount; }
public function testStopPropagationAndIsPropagationStopped() { $this->event->stopPropagation(); $this->assertTrue($this->event->isPropagationStopped()); }
/** * {@inheritdoc} */ public function dispatch($eventName, Event $event = null) { if (null === $event) { $event = new Event(); } if (null !== $this->logger && $event->isPropagationStopped()) { $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName)); } $this->preProcess($eventName); $this->preDispatch($eventName, $event); $e = $this->stopwatch->start($eventName, 'section'); $this->dispatcher->dispatch($eventName, $event); if ($e->isStarted()) { $e->stop(); } $this->postDispatch($eventName, $event); $this->postProcess($eventName); return $event; }
/** * Determine if the event has been stopped from propagating. * * @return bool */ public function isStopped() { return parent::isPropagationStopped(); }