本文整理汇总了PHP中Symfony\Component\EventDispatcher\Event::isPropagationStopped方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::isPropagationStopped方法的具体用法?PHP Event::isPropagationStopped怎么用?PHP Event::isPropagationStopped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\EventDispatcher\Event
的用法示例。
在下文中一共展示了Event::isPropagationStopped方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doDispatch
/**
* {@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);
}
}
示例2: brocast
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;
}
示例3: testStopPropagationAndIsPropagationStopped
public function testStopPropagationAndIsPropagationStopped()
{
$this->event->stopPropagation();
$this->assertTrue($this->event->isPropagationStopped());
}
示例4: dispatch
/**
* {@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;
}
示例5: isStopped
/**
* Determine if the event has been stopped from propagating.
*
* @return bool
*/
public function isStopped()
{
return parent::isPropagationStopped();
}