Fires an event.

@param  string $event
@param  mixed  $payload
@param  bool   $halt
@return mixed
979270
protected function fireEvent($event, $payload = [ ], $halt = false)
    {
        if (! isset($this->dispatcher)) {
            $this->initEventDispatcher();
        }

        $dispatcher = $this->dispatcher;
        $status     = $this->dispatcherStatus;
        if (! $dispatcher || $status === false) {
            return;
        }
        $method = $halt ? 'until' : 'fire';

        return $dispatcher->{$method}($event, $payload);
    }
772872
public function fire($event, &$payload = [], $halt = false)
    {
        // When the given "event" is actually an object we will assume it is an event
        // object and use the class as the event name and this event itself as the
        // payload to the handler, which makes object based events quite simple.
        if ( is_object($event) )
        {
            list($payload, $event, $eventName) = [ [$event], $event, get_class($event) ];
        }
        else
        {
            $eventName = $event;
        }

        $responses = [];

        // If an array is not given to us as the payload, we will turn it into one so
        // we can easily use call_user_func_array on the listeners, passing in the
        // payload to each of them so that they receive each of these arguments.
        if ( ! is_array($payload) )
        {
            $payload = [$payload];
        }

        $this->firing[] = $eventName;

        if ( isset($payload[0]) && $payload[0] instanceof ShouldBroadcast )
        {
            $this->broadcastEvent($payload[0]);
        }

        foreach ($this->getListeners($event) as $listener)
        {
            dd($listener());
        	
        	try
        	{
        		$response = call_user_func_array($listener, $payload);
        	}
            catch(ValidationException $e)
            {
            	$this->validationExceptions[] = $e;
            	$response = 0;
            }

            // If a response is returned from the listener and event halting is enabled
            // we will just return this response, and not call the rest of the event
            // listeners. Otherwise we will add the response on the response list.
            if (!is_null($response) && $halt)
            {
                array_pop($this->firing);

                return $response;
            }

            // If a boolean false is returned from a listener, we will stop propagating
            // the event to any further listeners down in the chain, else we keep on
            // looping through the listeners and firing every one in our sequence.
            if ($response === false)
            {
                break;
            }

            $responses[] = $response;
        }

        array_pop($this->firing);

        if( ! empty($this->validationExceptions) )
        {
        	throw new ValidationException([], 422, $this->validationExceptions);
        	
        }

        return $halt ? null : $responses;
    }
1224507
public function fireOnceIfNamed($event, $payload=[], $halt=false)
    {
        if(!$event){
            return;
        }
        return $this->fireOnce($event, $payload, $halt);
    }
478262
public function triggerEvent($event, Payload $payload): string
    {
        return $this->state($payload->state())->triggerEvent($event, $payload);
    }
473980
public function trigger($event, &$payload = null)
    {
        // Disallow calling a trigger on global hooks
        if ($event === '*') {
            return $this;
        }

        // Get all global hooks
        $globalHooks = [];
        if (isset($this->hooks['*']) && count($this->hooks['*']) > 0) {
            $globalHooks = $this->hooks['*'];
        }

        // Check if the event exists and has callables to run
        if (!isset($this->hooks[$event]) || count($this->hooks[$event]) === 0) {
            // There are no specific hooks, but maybe there's global hooks?
            if (count($globalHooks) === 0) {
                // There is nothing to do here
                return $this;
            }
            $hooks = $globalHooks;
        } else {
            $hooks = $this->hooks[$event];
            $hooks = array_merge($hooks, $globalHooks);
        }

        // All good, let's call those callables
        foreach ($hooks as $callable) {
            $callable($event, $payload);
        }
        return $this;
    }
1161038
public function fire($event, &$client, $data = null)
    {
        $retval = true;

        if (!array_key_exists($event, $this->events)) {
            return;
        }

        foreach ($this->events[$event] as $callback) {
            if (!is_callable($callback)) {
                continue;
            }

            if (($retval = call_user_func($callback, $this, $client, $data)) === false) {
                break;
            }
        }

        return $retval !== false;
    }
1074041
public function trigger(Payload $payload)
    {
        if (!$this->command) {
            return $this->targetState();
        }

        return call_user_func($this->command, $payload) ? $this->targetState() : $this->errorState();
    }
510136
public function fireEdit($id, $payload = [])
    {
        if (! method_exists($this, 'onEdit')) {
            return;
        }

        $payload = array_merge(['id' => $id], ['payload' => $payload]);

        $form = $this->app->call([$this, 'onEdit'], $payload);

        if ($form instanceof DisplayInterface) {
            $form->setModelClass($this->getClass());
        }

        if ($form instanceof Initializable) {
            $form->initialize();
        }

        if ($form instanceof FormInterface) {
            $form->setAction($this->getUpdateUrl($id));
            $form->setId($id);
        }

        return $form;
    }
1321050
protected function fireMoveEvent( $event, $halt = true )
	{
		// Basically the same as \Illuminate\Database\Eloquent\Model->fireModelEvent
		// but we relay the event into the node instance.
		$event = "eloquent.{$event}: " . get_class( $this->model );

		$method = $halt ? 'until' : 'fire';

		Hooks::trigger( $event, ['model' => $this->model] );
	}
614755
function onevent(event) {
        // Event should have the following properties:
        // * `id: string`: an event identifier.
        // * `type: string`: an event type.
        // * `data: any`: an event data.
        // * `reply: boolean`: true if this event requires the reply.

        // If the client sends a plain event, dispatch it.
        if (!event.reply) {
          self.emit(event.type, event.data);
        } else {
          var latch;
          // A function to create a function.
          function reply(success) {
            // A controller function.
            return function(value) {
              // This latch prevents double reply.
              if (!latch) {
                latch = true;
                self.send("reply", {id: event.id, data: value, exception: !success});
              }
            };
          }

          // Here, the controller is passed to the event handler as 2nd argument and allows
          // to call the server's `resolved` or `rejected` callback by sending `reply` event.
          self.emit(event.type, event.data, {resolve: reply(true), reject: reply(false)});
        }
      }
361629
public function fire(string $event, array $arguments = null) {
        return $this->getEventManager()->fire($event, $arguments);
    }
447803
protected function fire($event, $key, array $payload = [])
    {
        $payload[] = $this->context;

        if ($this->isEventsEnabled()) {
            $this->dispatcher->fire("settings.{$event}: {$key}", $payload);
        }
    }
818004
public function fire($event, $payload=[], $halt=false)
    {
        return $this->dispatcher->fire($event, $payload, $halt);
    }
1262898
public function notify($event, $payload)
    {
        $result = null;

        foreach ($this->handlers as $condition => $handlers) {
            if ('*' === $condition || ($condition & $event) === $event) {
                foreach ($handlers as $handler) {
                    if ($clause = $this->clauses[spl_object_hash((object) $handler)] ?? null) {
                        if ($clause->intercepted($payload)) {
                            continue;
                        }
                    }
                    $response = $this->callHandler($handler, $payload);

                    switch (true) {
                        case $response instanceof TerminateResult:
                            return $response->content;
                        case true === $response:
                            continue 2;
                        case false === $response:
                            break 2;
                        case !empty($response) && !($result instanceof FinallyResult):
                            $result = $response;
                    }
                }
            }
        }

        return $result instanceof FinallyResult ? $result->content : $result;
    }
222576
public function fire($event, $payload = [], $halt = false)
    {
        if (method_exists($this->event, 'dispatch')) {
            return $this->event->dispatch($event, $payload, $halt);
        }

        return $this->event->fire($event, $payload, $halt);
    }
998897
public function fireEvent($event)
    {
        $handle = $this->getQualifiedEvent($event);

        // Fire the event
        /** @var \League\Event\EventInterface $event */
        $event = $this->explainer->displayBelow(function () use ($handle) {
            return $this->events->emit($handle, [$this]);
        });

        // If the event returned a strict false, halt the task
        $wasHalted = $event && $event->isPropagationStopped();
        if ($wasHalted && $event !== 'halt' && method_exists($this, 'halt')) {
            $this->halt();
        }

        return !$wasHalted;
    }
256226
protected function fireServerEvent(string $event, array $params)
    {
        /** @var array[] $collector */
        $collector = ServerListenerCollector::getCollector();

        if (!isset($collector[$event]) || empty($collector[$event])) {
            return;
        }

        foreach ($collector[$event] as $beanClass) {
            $listener = App::getBean($beanClass);
            $method = SwooleEvent::getHandlerFunction($event);
            $listener->$method(...$params);
        }
    }