Dispatch the event.

@param string $event
@param array $arguments
434527
public function dispatchEvent($event, ...$arguments)
    {
        $this->dispatchEventToEventCallbacks($event, $arguments);

        $this->dispatchEventToEventHandler($event, $arguments);
    }
437001
public static function dispatch(string $event, array $args = [], bool $return = false)
    {
        // is there some registered $listeners ?
        if (isset(Event::$listeners[$event]) && count(Event::$listeners[$event]) > 0) {

            // Get all listeners for given event.
            $listeners = Event::$listeners[$event];

            // Sort by priority
            krsort($listeners);

            // Loop through $listeners array
            foreach ($listeners as $listener) {

                // Loop through $_listener array
                foreach ($listener as $_listener) {

                    // Return or Render specific $_listener results ?
                    if ($return) {
                        return call_user_func_array($_listener['function'], (isset($args) ? $args : $_listener['args']));
                    } else {
                        call_user_func_array($_listener['function'], (isset($args) ? $args : $_listener['args']));
                    }
                }
            }
        }
    }
223795
public static function fire($event, array $args = [])
    {
        if (!isset(self::$events[$event])) {
            return false;
        }

        // call event handlers of the event.
        foreach ((array)self::$eventHandlers[$event] as $cb) {
            // return FALSE to stop go on handle.
            if (false === PhpHelper::call($cb, ...$args)) {
                break;
            }
        }

        // is a once event, remove it
        if (self::$events[$event]) {
            return self::off($event);
        }

        return true;
    }
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;
    }
374451
protected function callOnListeners($event, $args = [])
    {
        $result = false;
        foreach ($this->getOnListeners($event) as $listener) {
            Helper::call($listener, $args);
        }
        return $result;
    }
155171
public function dispatch($event, array $param = [])
    {
        foreach ($this->listeners[$event] as $listener) {
            \call_user_func_array($listener, $param);
        }
    }
54628
def dispatch(self, event, *args):
        

        for callback in self.listeners.get(event, []):
            if len(args) > 0:
                callback(*args)
            else:
                callback()
1202375
public function fireReflected(string $event, array $arguments = null) {
        return $this->getEventManager()->fireReflected($event, $arguments);
    }
761521
protected function dispatchEvent($event)
    {
        if (!$this->container) {
            throw new \RuntimeException("The container has not been set up.");
        }
        $dir = $this->container->getParameter('base_dir');
        if (!is_dir($dir) || !is_readable($dir)) {
            throw new \RuntimeException("'${dir}' is not a valid readable directory.");
        }
        $dispatcher = $this->container->get('event_dispatcher');
        $dispatcher->dispatch($event);
    }
452413
public function handleEvent($event, array $args)
    {
        $logger = $this->getLogger();

        $eventObjects = array_filter($args, function($arg) {
            return $arg instanceof EventInterface;
        });
        if (!$eventObjects) {
            $logger->info('Event emitted without EventInterface argument', array(
                'event' => $event,
                'args' => $args,
            ));
        } else {
            $eventObject = reset($eventObjects);
            if ($this->filter->filter($eventObject) === false) {
                $logger->info('Event did not pass filter, skipping', array(
                    'event' => $event,
                    'args' => $args,
                ));
                return;
            } else {
                $logger->info('Event passed filter, forwarding', array(
                    'event' => $event,
                    'args' => $args,
                ));
            }
        }

        $callbacks = $this->getEventHandlers($event);
        foreach ($callbacks as $callback) {
            $logger->info('Forwarding event to callback', array(
                'event' => $event,
                'args' => $args,
                'callback' => $callback,
            ));
            call_user_func_array($callback, $args);
        }
    }
1214871
public function onEvent(Event $event = null)
    {
        while (!empty($this->messages)) {
            $message = array_shift($this->messages);

            $this->handle($message, $this->dispatcher);
        }
    }
299707
protected function dispatchEventToEventCallbacks($event, $arguments)
    {
        foreach ($this->getEventCallbacks($event) as $callback) {
            try {
                call_user_func_array($callback, $arguments);
            } catch (Exception $e) {
                $this->handleException($e);
            } catch (Throwable $e) {
                $this->handleException(new FatalThrowableError($e));
            }
        }
    }
830481
protected function fireEvent($event)
    {
        $this->app['events']->fire(sprintf('modules.%s.'.$event, $this->getLowerName()), [$this]);
    }
1164318
final public function dispatch(Event $event): void
    {
        if (!$event instanceof ReceivedEvent && $this->discriminator->shouldEnqueue($event)) {
            $this->queue->send($event);
        }

        if ($event instanceof ReceivedEvent) {
            $event = $event->getOriginalEvent();
        }

        $this->wrappedEventBus->dispatch($event);
    }
1039764
public function emit($event, array $arguments = [])
    {
        parent::emit($event, $arguments);
        if ($this->broker) {
            $this->broker->emit($event, $arguments);
        }
    }
234296
private function fireEvent($event, ...$params)
    {
        if (!$this->eventManager) {
            return;
        }

        $this->eventManager->handle($event, ...$params);
    }
991839
public function dispatch(DomainEvents $events) : void {
        $events->each(function (DomainEvent $event) {
            $this->listeners->each(function (Listener $listener) use ($event) {
                    $listener->handle($event);
            });
        });
    }