Attempts to dispatch an event
@param Subscription $subscription
@param Event $event
@return boolean True if dispatch was successful, false otherwise
8903
private function tryDispatch(Subscription $subscription, Event $event)
        {
            $dispatched = false;

            try {
                $dispatched = $this->doDispatch($subscription, $event);
            } catch (\Exception $ex) {
                if (! $this->silent) {
                    throw new \RuntimeException('Dispatch triggered an exception', 0, $ex);
                }

                $message = sprintf(self::FMT_ERR_DISPATCH, $event->getId(), $ex->getMessage());

                $this->logger->error($message, array(
                'event-category' => $event->getCategory(),
                'subscription-filter' => $subscription->getCategoryFilter(),
                'subscriber_class' => get_class($subscription->getSubscriber()),
                'message' => $ex->getMessage(),
                'trace' => $ex->getTraceAsString()
                ));
            }

            return $dispatched;
        }
637301
public function triggerSubscriptionRebill(GatewayInterface $gateway, SubscriptionInterface $subscription, RebillInterface $rebill)
    {
        $this->trigger(self::ON_SUBSCRIPTION_REBILLED, $gateway, $subscription, $rebill);
    }
1028889
public void deliverEvent(AbstractTaskEvent event) {

		synchronized (this.subscriptions) {

			List<EventListener> subscribers = this.subscriptions.get(event.getClass());
			if (subscribers == null) {
				return;
			}

			final Iterator<EventListener> it = subscribers.iterator();
			while (it.hasNext()) {
				it.next().eventOccurred(event);
			}
		}
	}
1340925
public function dispatch(Event $event) {

		$this->lastEvent = $event;
		$eventName = $event->getName();

		if (isset($this->registry[$eventName])) {

			foreach ($this->getSortedRegistry($eventName) as $listener) {
				call_user_func($listener, $event);
			}
			
		}

	}
1125886
protected function dispatch(string $name, Event $event = null): Event
    {
        if (empty(self::$dispatchers[static::class])) {
            //We can bypass dispatcher creation
            return $event;
        }

        return static::getEventDispatcher()->dispatch($name, $event);
    }
1186231
public function dispatchEvent($eventName, EventInterface $event = null)
    {
        $this->getEventDispatcher()->dispatch($eventName, $event);
        
        return $this;
    }
1012898
public function triggerSubscriptionChanged(GatewayInterface $gateway, SubscriptionInterface $subscription, ChangeInterface $change)
    {
        $this->trigger(self::ON_SUBSCRIPTION_CHANGED, $gateway, $subscription, $change);
    }
933667
public function dispatch($event): void
    {
        Assertion::isObject($event, 'An event should be an object');

        $eventName = get_class($event);
        $eventSubscribers = array_merge(
            $this->subscribedToAllEvents,
            $this->subscribers[$eventName] ?? []
        );

        foreach ($eventSubscribers as $eventSubscriber) {
            $eventSubscriber($event);
        }
    }
393052
public function addSubscriber(EventSubscriberInterface $subscriber)
    {
        if ($subscriber instanceof HttpClientEventSubscriber) {
            $subscriber->attachHttpClient($this);
        }

        $this->eventDispatcher->addSubscriber($subscriber);
    }
633696
public function add_subscriber( EventSubscriber $subscriber ) {

		foreach ( $subscriber->get_subscribed_events() as $event => $params ) {

			if ( is_string( $params ) ) {
				$this->add_listener( $event, array( $subscriber, $params ) );
			} elseif ( is_array( $params ) && isset( $params[0] ) ) {

				$method        = $params[0];
				$priority      = isset( $params[1] ) ? $params[1] : self::PRIORITY;
				$accepted_args = isset( $params[2] ) ? $params[2] : self::ACCEPTED;

				$this->add_listener( $event, array( $subscriber, $method ), $priority, $accepted_args );
			} else {
				throw new \InvalidArgumentException( 'Invalid return format from EventSubscriber.' );
			}
		}

		return $this;
	}
1279109
public void subscribe(Class<? extends Event> eventType, Class<? extends Subscriber> subscriberType) {
        if (!subscriptionMap.containsKey(eventType)) {
            subscriptionMap.put(eventType, new ArrayList<>());
        }
        final ArrayList<Class<? extends Subscriber>> subscribers = subscriptionMap.get(eventType);
        if (!subscribers.contains(subscriberType)) {
            subscribers.add(subscriberType);
        }
    }
1141872
public function unsubscribe(Subscription $subscription)
    {
        if (!$this->isConnected) {
            return new RejectedPromise(new \LogicException('The client is not connected.'));
        }

        return $this->startFlow(new OutgoingUnsubscribeFlow([$subscription], $this->identifierGenerator));
    }
524218
public function triggerSubscriptionDeactivated(GatewayInterface $gateway, SubscriptionInterface $subscription, CancelationInterface $cancelation)
    {
        $this->trigger(self::ON_SUBSCRIPTION_DEACTIVATED, $gateway, $subscription, $cancelation);
    }
778460
public function dispatch($eventName, Event $event = null)
    {
        if (null == $event) {
            $event = new Event($eventName);
        }

        return $this->doDispatch($event);
    }
415008
public function dispatch($eventName, Event $event)
    {
        if (!$this->hasListeners($eventName)) {
            return $event;
        }

        // setting event name
        $event->setName($eventName);

        // execute all callbacks for a event given
        foreach ($this->getListeners($event->getName()) as $listener) {
            call_user_func($listener, $event);

            if ($event->isPropagationStopped()) {
                break;
            }
        }

        return $event;
    }
881764
function handle(Event $event)
    {
        if ($this->accept($event)) {
            $this->onEvent($event);
            return true;
        }

        return false;
    }
347354
private function dispatchEvent($em, $event)
    {
        $eventArgs = new LifecycleEventArgs(null, $em);

        $em->getEventManager()
           ->dispatchEvent($event, $eventArgs);
    }