Dispatches an event with the @param $eventId only if it exists.

@param 	$eventId <String>
@param 	$subscriber <Kit\Glider\Events\Contract\Subscriber>
@access 	public
@return 	<void>
510639
public function dispatchEvent(String $eventId, $subscriber=null)
	{
		if (isset(EventManager::$listeners[$eventId])) {
			foreach(EventManager::$listeners[$eventId] as $listener) {
				call_user_func_array($listener, [$subscriber]);
			}
		}
	}
443897
public function removeSubscriber(EventSubscriberInterface $subscriber)
	{
		foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
			if (\is_array($params) && \is_array($params[0])) {
				foreach ($params as $listener) {
					$this->detach($eventName, [$subscriber, $listener[0]]);
				}
			} else {
				$this->detach($eventName, [$subscriber, \is_string($params) ? $params : $params[0]]);
			}
		}

		return $this;
	}
404700
public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('drupal.event_dispatcher')) {
            return;
        }
        $dispatcherDefinition = $container->getDefinition('drupal.event_dispatcher');

        foreach ($container->findTaggedServiceIds('drupal.event_subscriber') as $id => $attributes) {
            foreach ($attributes as $attribute) {
                $priority = isset($attribute['priority']) ? intval($attribute['priority']) : 0;
                $dispatcherDefinition->addMethodCall(
                    'addSubscriber',
                    array(new Reference($id), $priority)
                );
            }
        }
    }
578108
public function getEventSubscriber($subscriber, $config = array())
    {
        if (! ($subscriber instanceof AnServiceIdentifier)) {
            //Create the complete identifier if a partial identifier was passed
            if (is_string($subscriber) && strpos($subscriber, '.') === false) {
                $identifier = clone $this->getIdentifier();
                $identifier->path = array('event', 'handler');
                $identifier->name = $subscriber;
            } else {
                $identifier = $this->getIdentifier($subscriber);
            }
        }
    
        if (! isset($this->_event_subscribers[(string) $identifier])) {
            $config['event_dispatcher'] = $this->getEventDispatcher();
            $subscriber = $this->getService($identifier, $config);
             
            //Check the event subscriber interface
            if (! ($subscriber instanceof AnEventSubscriberInterface)) {
                throw new AnEventSubscriberException("Event Subscriber $identifier does not implement AnEventSubscriberInterface");
            }
        } else {
            $subscriber = $this->_event_subscribers[(string) $identifier];
        }
         
        return $subscriber;
    }
1161353
public function onSubscribe(SubscriberEvent $event)
    {
        $this->listRepository->subscribe(
            $event->getListId(),
            $event->getSubscriber()
        );
    }
956718
public function setSubscribed($id, $subscribed)
    {
        return $this->put($this->getPath().'/'.rawurlencode($id).'/subscribed', array('value' => $subscribed));
    }
444284
public function addSubscriber(EventSubscriberInterface $subscriber)
    {
        foreach ($subscriber->getSubscribedEvents() as $name => $params) {
            if (is_string($params)) {
                $this->addListener($name, [$subscriber, $params]);
            } elseif(is_string($params[0]) && is_numeric($params[1])) {
                $this->addListener($name, [$subscriber, $params[0]], $params[1]);
            } else {
                foreach ($params as $param) {
                    if (is_string($param)) {
                        $this->addListener($name, [$subscriber, $param]);
                    } else {
                        $this->addListener($name, [$subscriber, $param[0]], isset($param[1]) ? $param[1] : 0);
                    }
                }
            }
        }
    }
160096
public function removeSubscriber(EventSubscriberInterface $subscriber)
    {
        unset($this->subscribers[array_search($subscriber, $this->subscribers, true)]);
        $this->subscribers = empty($this->subscribers) ? [] : array_values($this->subscribers);

        return $this;
    }
717177
public function deleteSubscription($subscriptionId)
    {
        $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarSubscriptionsTableName.' WHERE id = ?');
        $stmt->execute([$subscriptionId]);
    }
835573
public function dispatch($event, Event $eventObject)
    {
        if (!isset($this->listeners[$event])) {
            return;
        }
        
        foreach ($this->listeners[$event] as $listener) {
            call_user_func_array($listener, array($eventObject));
            
            if ($eventObject->propagationHalted()) {
                break;
            }
        }
    }
233202
protected function invokeSubscription(IEventSubscription $subscription, IEvent $event) {
        foreach ($this->invokers as $invoker) {
            if ($invoker->invoke($subscription, $event)) {
                return;
            }
        }

        $subscriber = $subscription->getSubscriber();

        throw new Exception(
            s('Could not invoke subscriber "%s".',
                is_scalar($subscriber) ? $subscriber : get_type($subscriber))
        );
    }
174986
@Override
    public synchronized void dispatch(@NonNull Event event) {
        String type = event.type;
        List<EventHandlerWrapper> eventHandlers = subscribers.get(type);
        if (eventHandlers != null) {
            EventHandlerWrapper handler = null;
            for (int i = 0, size = eventHandlers.size(); i < size; i++) {
                handler = eventHandlers.get(i);
                if (handler.eventHandlerReceiver != null) {
                    handler.handleEvent(event);
                } else {
                    if (!TextUtils.isEmpty(handler.producer) && handler.producer.equals(event.sourceId)
                            || TextUtils.isEmpty(handler.producer)) {
                        handler.handleEvent(event);
                    }
                }
            }
        }
    }
849394
public function reactivateSubscription($subscriptionId)
    {
        $requestData = new Reactivate\RequestData($subscriptionId);
        $request = new Reactivate\Request($requestData);

        return $this->sendRequest($request, Reactivate\ApiResponse::class);
    }
268065
public function onNewsletterSubscribeFlush(NewsletterSubscriptionEvent $event)
    {
        $subscription = $event->getNewsletterSubscription();

        $this->newsletterObjectManager->persist($subscription);
        $this->newsletterObjectManager->flush($subscription);
    }
1137644
public function addSubscriberService($serviceId, $class)
    {
        foreach ($class::getSubscribedEvents() as $eventName => $params) {
            if (is_string($params)) {
                $this->addListenerService($eventName, array($serviceId, $params), 0);
            } elseif (is_string($params[0])) {
                $this->addListenerService($eventName, array($serviceId, $params[0]), isset($params[1]) ? $params[1] : 0);
            } else {
                foreach ($params as $listener) {
                    $this->addListenerService($eventName, array($serviceId, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
                }
            }
        }
    }
758317
public function addSubscriber(EventSubscriber $eventSubscriber)
    {
        $listeners = $eventSubscriber->getEvents();

        foreach($listeners as $listener => $data)
        {
            if (is_array($data)) {
                $data = new SubscriberConfiguration($data[0], $data[1] ?? self::USE_ALL, $data[2] ?? 100);
            }

            if (!$data instanceof SubscriberConfiguration) {
                throw new \InvalidArgumentException(
                    'SubscriberConfiguration for ' . $listener . ' in ' . get_class($eventSubscriber) . ' is invalid!'
                );
            }

            // horrible hack due to array not being a callable in this case ... whut?
            $listenerCallable = function($events) use ($eventSubscriber, $listener) {
                $eventSubscriber->{$listener}($events);
            };

            $this->addWeightedListener(
                $listenerCallable,
                $data->getUseType(),
                $data->getWeight(),
                ...$data->getEvents()
            );
        }
    }
94276
public void setSubscriberID(String subscriptionID)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setSubscriberID", subscriptionID);

        this.subscriptionID = subscriptionID;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setSubscriberID");
    }