Dispatch all listeners of the given event.

Event::dispatch('event_name');

@access public
@param  string  $event       Event name
@param  array   $args        Arguments
@param  bool    $return      Return data or not. Default is false
@return mixed
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']));
                    }
                }
            }
        }
    }
287901
public function invokeCallbacks($event, $arg)
    {
        $this->checkEventType($event);
        foreach ($this->events[$event] as $callback) {
            call_user_func($callback, $arg);
        }
    }
27704
public static function dispatch($pName, array $pArgs = array())
    {
        if (self::$_events === NULL) {
            self::setEvents();
        }

        $i = 0;
        foreach (self::$_events as $name => $event) {
            if ($name === $pName and is_array($event)) {
                foreach ($event as $class => $methods) {
                    if (is_array($methods)) {
                        $class = Loader::getSingleton($class);
                        if ($class === NULL) {
                            continue;
                        }

                        foreach ($methods as $method) {
                            if (method_exists($class, $method)) {
                                $class::$method($pArgs);
                                $i++;
                            }
                        }
                    }
                }
            }
        }

        return $i;
    }
190132
public function add_listener($event) {
		if (strpos('::', $event) === false) {
			$classname = get_called_class();
			$method = $event;
		} else {
			list($classname, $method) = explode('::', $event);
		}
		$event_name = strtolower(str_replace('\\', '_', $classname . '_' . $method));

		$dispatcher = \Skeleton\Event\Dispatcher::get();
		$dispatcher->add_listener($event_name, [ '\\Event\\' . $classname, $method ]);
	}
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;
    }
938194
public function trigger(string $event, ...$args)
    {
        $this->getEventHandler()->trigger($event, ...$args);
        return $this;
    }
526499
def dispatchEvent(self, event, *args):
        
        for callback in self.listeners[event]:
            yield callback(event, self, *args)
901792
public function dispatch(EventInterface $event)
    {
        if (array_key_exists($event->getName(), $this->listeners)) {
            foreach ($this->listeners[$event->getName()] as $listener) {
                $listener($event);
            }
        }

        return $event;
    }
1234349
public static function runOne($events, $args)
    {
        foreach ($events as $key => $value) {
            $name = '\Vinala\App\Events\\'.$key;

            $object = new $name();

            $function = self::$listners[$key.'.'.$value];

            call_user_func_array([$object, $function], $args);
        }

        return true;
    }
534085
public function dispatch($event, $options)
    {
        if (! array_key_exists($event, $this->listeners)) {
            // no callbacks given for this event
            return;
        }

        // Iterate through each Listener attached to this event
        // and call it with the given options
        foreach ($this->listeners[$event] as $callable) {
            call_user_func($callable, $options);
        }
    }
667618
public function trigger($event, $args = array())
	{
		if (!($event instanceof Event))
		{
			if (isset($this->events[$event]))
			{
				$event = $this->events[$event];
			}
			else
			{
				$event = new Event($event);
			}
		}

		// If a listener group was specified
		// lazy load the listeners.
		if ($group = $event->getGroup())
		{
			$this->addListeners($group);
		}

		// Attach any incoming aruments
		foreach ((array) $args as $name => $arg)
		{
			$event->addArgument($name, $arg);
		}

		// Are there any listeners for this event?
		if (isset($this->listeners[$event->getName()]))
		{
			foreach ($this->listeners[$event->getName()] as $listener)
			{
				// Call the event listener
				if ($listener instanceof Closure)
				{
					$response = call_user_func($listener, $event);
				}
				else
				{
					$response = call_user_func(array($listener, $event->getName()), $event);
				}

				// Attach response
				if (!is_null($response))
				{
					$event->addResponse($response);
				}

				// Is propagation stopped?
				if ($event->isStopped())
				{
					break;
				}
			}
		}

		return $event->getResponse();
	}
155171
public function dispatch($event, array $param = [])
    {
        foreach ($this->listeners[$event] as $listener) {
            \call_user_func_array($listener, $param);
        }
    }
347151
function dispatchEvent(event, handlers) {
    for (var i = (handlers.length - 1); i >= 0; i--) {
        if (event.isPropagationStopped()) {
            break;
        }
        var returnValue = handlers[i](event);
        if (returnValue === false) {
            event.stopPropagation();
            event.preventDefault();
        }
    }
}
856224
def call(event, *args)
      return unless @listeners[event]
      @listeners[event].each do |callback|
        callback.call(*args)
      end
    end
1041654
public function dispatch() {
		$params = func_get_args();
		$event = array_shift($params);
		if (strpos('::', $event) === false) {
			$classname = get_called_class();
			$method = $event;
		} else {
			list($classname, $method) = explode('::', $event);
		}
		$event_name = strtolower(str_replace('\\', '_', $classname . '_' . $method));

		$dispatcher = \Skeleton\Event\Dispatcher::get();
		if ($dispatcher->has_listener($event_name) === false) {
			$this->add_listener($event);
		}

		$dispatcher->dispatch($event_name, $params);
	}
506072
protected function _proxyEvent($event, $args = array())
    {
        //Publish the event
        if (class_exists('Koowa')) {
            KObjectManager::getInstance()->getObject('event.publisher')->publishEvent($event, $args, JFactory::getApplication());
        }
    }
818120
public function dispatch($function, $args) {
        $class_name = get_class($this);
        $class = new \ReflectionClass($class_name);
        if ($function == '') {
            $function = $class->getConstant('DEFAULT_FUNCTION');
        }
        $function = str_replace('.', '', $function);
        if ($function == '') {
            return $this->show_404();
        }
        $function = 'c_' . $function;
        if (!$class->hasMethod($function)) {
            return $this->show_404();
        }

        $func = $class->getMethod($function);
        $func->setAccessible(true);
        try {
            $func->invoke($this, $args);
        }
        catch (\Exception $ex) {
            if (DEBUG === 1) {
                return $this->show_msg($ex->getMessage(), 'Error');
            }
            else {
                return $this->show_404();
            }
        }
    }