This method dispatches only those listeners that were marked as async.

@param string     $eventName
@param Event|null $event
188255
public function dispatchAsyncListenersOnly($eventName, Event $event = null)
    {
        try {
            $this->asyncListener->syncMode($eventName);

            parent::dispatch($eventName, $event);
        } finally {
            $this->asyncListener->resetSyncMode();
        }
    }
619679
public function removeListener(string $eventName, $listener): void
    {
        $this->dispatcher->removeListener($eventName, $listener);
    }
984746
public function dispatch($eventName, Eresus_Event $event = null)
    {
        if (!array_key_exists($eventName, $this->listeners))
        {
            return;
        }

        if (null === $event)
        {
            $event = new Eresus_Event();
        }

        $event->setName($eventName);

        krsort($this->listeners[$eventName]);

        foreach ($this->listeners[$eventName] as $listeners)
        {
            foreach ($listeners as $listener)
            {
                call_user_func($listener, $event);
                if ($event->isPropagationStopped())
                {
                    break 2;
                }
            }
        }
    }
682314
public function subscribeEvent($eventName)
    {
        if (!isset($this->subscribedEvents[$eventName])) {
            throw new InvalidArgumentException("Event $eventName doesn't exists in client context");
        }

        $this->subscribedEvents[$eventName] = true;
    }
162182
public function dispatchEvent($name, $event = array())
    {
        $result = array();
        
        //Make sure we have an event object
        if (! $event instanceof AnEvent) {
            $event = new AnEvent($event);
        }
        
        $event->setName($name)->setDispatcher($this);
             
        //Nofity the listeners
        if (isset($this->_listeners[$name])) {
            foreach ($this->_listeners[$name] as $listener) {
                $listener->$name($event);
                
                if (! $event->canPropagate()) {
                    break;
                }
            }
        }
        
        return $this;
    }
639465
public function addListener(string $eventName, $listener) : void
    {
        $this->dispatcher->addListener($eventName, $listener);
    }
611101
public function dispatch($eventName, EventArguments $arguments = null)
    {
        if (false === $this->hasListeners($eventName)) {
            return $this;
        }
        $arguments = $arguments ?: EventArguments::createEmpty();
        foreach ($this->getListeners($eventName) as $listener) {
            $listener->$eventName($arguments);
        }
        return $this;
    }
691992
public function dispatch( $event_name, Event $event = null ) {

		if ( is_null( $event ) ) {
			$event = new Event();
		}

		do_action( $this->get_action_name_for_event( $event_name ), $event, $event_name, $this );

		return $event;
	}
232644
public function dispatchUntil($eventName, Event $event)
    {
        // skip dispatching because event is already dispatched
        if ($event->isProcessed()) {
            return $event;
        }

        // skip dispatching because event hasn't listeners
        if (!$this->hasListeners($eventName)) {
            return $event;
        }

        $event->setName($eventName);

        foreach ($this->getListeners($event->getName()) as $listener) {
            if (call_user_func($listener, $event)) {
                $event->setProcessed(true);
                break;
            }
        }

        return $event;
    }
484007
public function dispatch($eventName, Event $event = null)
    {
        $this->lazyLoad($eventName);

        return parent::dispatch($eventName, $event);
    }
1085170
protected function lazyLoad($eventName)
    {
        parent::lazyLoad($eventName);

        if (isset($this->listenerIds[$eventName])) {
            foreach ($this->listenerIds[$eventName] as $args) {
                list($serviceId, $method, $priority, $queueName) = $args;
                if ($queueName != null) {
                    $listener = $this->container->get($serviceId);
                    $key = $serviceId.'.'.$method;
                    $this->listeners[$eventName][$key] = array($listener, $queueName);
                }
            }
        }
    }
1302231
public function triggerEvent($eventName, Event $event = null)
    {
        if (!$event) {
            $event = new Event;
        }

        $event->setTarget($this);

        return $this->eventDispatcher->dispatch($eventName, $event);
    }
149340
public function unsubscribeEvent($eventName)
    {
        if (!isset($this->subscribedEvents[$eventName])) {
            throw new InvalidArgumentException("Event $eventName doesn't exists in client context");
        }

        $this->subscribedEvents[$eventName] = false;
    }
745487
public function hasListeners($eventName = null) {

	    if($eventName) {
            return !empty($this->registry[$eventName]);
        }

        foreach($this->registry as $eventName => $listeners) {
            if(!empty($listeners)) {
                return true;
            }
        }

        return false;

    }
1310663
public function dispatch($eventName, Event $event = null)
    {
        if (null === $event) {
            $event = new Event();
        }

        $event->setDispatcher($this);
        $event->setName($eventName);

        if (!isset($this->listeners[$eventName])) {
            return $event;
        }

        $this->doDispatch($this->getListeners($eventName), $eventName, $event);

        return $event;
    }
1214871
public function onEvent(Event $event = null)
    {
        while (!empty($this->messages)) {
            $message = array_shift($this->messages);

            $this->handle($message, $this->dispatcher);
        }
    }
614892
public function trigger($eventName, $target = null)
    {
        $event = $this->createEvent($eventName);
        $event->setTarget($target);
        $this->triggerHandlers($event);
    }