Dispatches an event if the event dispatcher is available

@param string $eventName
@param mixed $data
435394
public function dispatch($eventName, $data = null)
    {
        if (!interface_exists('Symfony\Component\EventDispatcher\EventDispatcherInterface')) {
            return;
        }

        if (null === $this->dispatcher) {
            return;
        }

        $event = new VcsEvent($data);

        $this->dispatcher->dispatch($eventName, $event);
    }
1143160
protected function fireEvent($eventName, Event $event)
    {
        if (!$this->eventDispatcher) {
            throw new \BadMethodCallException(sprintf(
                'Method %s() cannot be used while event dispatcher is not configured.',
                __METHOD__
            ));
        }

        $this->eventDispatcher->dispatch($eventName, $event);
    }
238460
public static function dispatchEvent($eventType, $subject = null, $data = null, $cancelable = true)
    {
        return self::getEventManager()->dispatch($eventType, $subject, $data, $cancelable);
    }
915361
public function dispatch($event/*, string $eventName = null*/)
    {
        $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;

        if (\is_object($event)) {
            $eventName = $eventName ?? \get_class($event);
        } else {
            @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), E_USER_DEPRECATED);
            $swap = $event;
            $event = $eventName ?? new Event();
            $eventName = $swap;

            if (!$event instanceof Event) {
                throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
            }
        }

        $listeners = $this->getListeners($eventName);
        $stoppable = $event instanceof Event || $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;

        foreach ($listeners as $listener) {
            if ($stoppable && $event->isPropagationStopped()) {
                break;
            }
            $listener($event, $eventName, $this);
        }

        return $event;
    }
860463
protected function dispatchDataTablesEvent($eventName, array $entities) {

        $eventDispatcher = $this->getEventDispatcher();
        if (null !== $eventDispatcher && false === $eventDispatcher->hasListeners($eventName)) {
            return null;
        }

        $this->getLogger()->debug(sprintf("DataTables controller dispatch an event with name \"%s\"", $eventName));

        return $eventDispatcher->dispatch($eventName, new DataTablesEvent($eventName, $entities));
    }
1368299
protected function dispatch($eventName, Event $event = null)
    {
        if ($event == null) {
            $event = new DefaultActionEvent();
        }

        $this->getDispatcher()->dispatch($eventName, $event);
    }
942644
public function notify($eventName, array $params = array())
    {
        $this->dispatcher->notify($e = $this->createEvent($eventName, $params));
        return $e;
    }
1304146
public function on($eventName, $callback, $priority = 0)
    {
        if ($this->booted) {
            $this->container['event_dispatcher']->addListener($eventName, $this->container['callback_resolver']->resolveCallback($callback), $priority);

            return;
        }

        $this->container->extend('event_dispatcher', function ($dispatcher, $c) use ($callback, $priority, $eventName) {
            $dispatcher->addListener($eventName, $c['callback_resolver']->resolveCallback($callback), $priority);

            return $dispatcher;
        });
    }
857846
protected function dispatch($name, Event $event)
    {
        $this->assertEventName($name);
        $this->getEventDispatcher()->dispatch($name, $event);
        return $this;
    }
408494
public void dispatch_event(final EventData eventData) {
        final TangoAttConfig tangoAttConfig = this;
        if (EventUtil.graphicAvailable()) {
            //   Causes doRun.run() to be executed asynchronously
            //      on the AWT event dispatching thread.
            Runnable do_work_later = new Runnable() {
                public void run() {
                    fireTangoAttConfigEvent(tangoAttConfig,eventData);
                }
            };
            SwingUtilities.invokeLater(do_work_later);
        }
        else
            fireTangoAttConfigEvent(tangoAttConfig, eventData);
   }
739019
public function handle($eventName, $data = null)
    {
        $results = [];

        if ($actions = $this->getEventActions($eventName)) {

            $actions = is_array($actions) ? $actions : [$actions];
            $data = is_array($data) ? $data : [$data];

            foreach ($actions as $action) {
                if ($result = $this->call($eventName, $action, $data)) {
                    $results[$action] = $result;
                }
            }
        }

        return count($results) === 1 ? reset($results) : $results;
    }
1114563
public function dispatch($event/*, string $eventName = null*/)
    {
        $eventName = 1 < \func_num_args() ? \func_get_arg(1) : null;

        if (\is_object($event)) {
            $eventName = $eventName ?? \get_class($event);
        } else {
            @trigger_error(sprintf('Calling the "%s::dispatch()" method with the event name as first argument is deprecated since Symfony 4.3, pass it second and provide the event object first instead.', EventDispatcherInterface::class), E_USER_DEPRECATED);
            $swap = $event;
            $event = $eventName ?? new Event();
            $eventName = $swap;

            if (!$event instanceof Event) {
                throw new \TypeError(sprintf('Argument 1 passed to "%s::dispatch()" must be an instance of %s, %s given.', EventDispatcherInterface::class, Event::class, \is_object($event) ? \get_class($event) : \gettype($event)));
            }
        }

        if (null !== $this->optimized && null !== $eventName) {
            $listeners = $this->optimized[$eventName] ?? (empty($this->listeners[$eventName]) ? [] : $this->optimizeListeners($eventName));
        } else {
            $listeners = $this->getListeners($eventName);
        }

        if ($listeners) {
            $this->callListeners($listeners, $eventName, $event);
        }

        return $event;
    }
1195138
public function sendEvent($id, $data, $eventName)
    {
        $this->sendBlock($id, $data, $eventName);
        $this->flush();
    }
382284
public function onModeScriptCallbackArray($eventName, $parameters)
    {
        $parameters = $this->parseParameters($parameters);
        $this->dispatcher->dispatch($eventName, [$parameters]);
    }
1087492
protected function call($eventName, $method, $data = null)
    {
        if (method_exists($this, $method)) {
            $result = call_user_func_array([$this, $method], $data);
            return $result;
        }

        return null;
    }
1041387
protected function triggerEvent($eventName, NodeInterface $node = null)
    {
        if (isset($this->activeEvents[$eventName])) {
            $this->dispatcher->dispatch($eventName, $this->sharedEvent->setNode($node));
        }

        return $this;
    }
1344142
private function triggerEvent($eventName, $data)
    {
        if(isset($this->eventHandlers[$eventName]))
        {
            $args = func_get_args();
            array_shift($args);

            foreach ($this->eventHandlers[$eventName] as $callback)
            {
                $clone = $args;
                call_user_func_array($callback, $clone);
            }
        }
    }