Handle the given event, if a handler exists.

@param object $event
@return mixed
485387
public function handle($event)
    {
        $method = $this->getMethodFor($event);

        if (method_exists($this, $method)) {
            return call_user_func([$this, $method], $event);
        }
    }
675761
public function handleNodeFromRegistry($event)
    {
        if ($event->hasNode()) {
            return;
        }

        $document = $event->getDocument();

        if (!$this->documentRegistry->hasDocument($document)) {
            return;
        }

        $node = $this->documentRegistry->getNodeForDocument($document);
        $event->setNode($node);
    }
1180817
public function trigger($event)
    {
        if ($this->has($event)) {
            return call_user_func($this->listeners[$event]);
        } else {
            throw new RuntimeException(sprintf(
                'Cannot trigger non-existing event "%s"', $event
            ));
        }
    }
1139123
public function triggerEvent($event)
	{
		if (!($event instanceof EventInterface))
		{
			if (isset($this->events[$event]))
			{
				$event = $this->events[$event];
			}

			else
			{
				$event = new Event($event);
			}
		}

		if (isset($this->listeners[$event->getName()]))
		{
			foreach ($this->listeners[$event->getName()] as $listener)
			{
				if ($event->isStopped())
				{
					return $event;
				}

				if ($listener instanceof Closure)
				{
					call_user_func($listener, $event);
				}

				else
				{
					call_user_func(array($listener, $event->getName()), $event);
				}
			}
		}

		return $event;
	}
745575
protected function raiseEvent($event)
    {
        if (!isset($this->eventHandlers[$event])) {
            return null;
        }

        $args = func_get_args();
        $args = array_slice($args, 1);

        // Check if the last argument is a callback.
        $count = count($args);
        $callBack = false;

        if (($count > 0) && is_object($args[$count - 1]) && is_callable($args[$count - 1])) {
            $callBack = $args[$count - 1];
            $args = array_slice($args, 0, -1);
        }

        $result = null;

        foreach ($this->eventHandlers[$event] as $delegate) {
            $answer = call_user_func_array($delegate, $args);

            if ($callBack !== false && $answer !== null) {
                call_user_func($callBack, $answer);
            }

            // If we don't have a result yet - make this the result. This way the first event handler to
            // return a non null result will be the overall result of the event.
            if ($result === null) {
                $result = $answer;
            }
        }

        return $result;
    }
1293842
public function handle(Event $event)
    {
        $name = $event->getName();
        $emitter = $event->getEmitter();
        $emitter->removeListener($name, $this);

        unset($name, $emitter);

        call_user_func_array($this->handler, [$event]);
    }
638580
public function handle($event)
    {
        if ($event instanceof CExceptionEvent)
            $this->logExceptionEvent($event);
        else
            $this->logErrorEvent($event);
        parent::handle($event);
    }
1008797
private function runHandlers($event, $data = null)
    {
        foreach ($this->handlers[$event] as $handler) {
            if (!is_callable($handler)) {
                return false;
            }

            if (!$handler($data)) {
                return false;
            }
        }
        return true;
    }
31907
public function handle($event)
    {
        if ($event instanceof RouteMatched) {
            $this->handleLaravelRoute($event);
        }

        if ($event instanceof GzeroRouteMatched) {
            $this->handleRoute($event);
        }
    }
1308059
public function trigger($event)
    {
        $result = false;
        if (isset(self::$event[$event])) {
            $result = call_user_func_array(self::$event[$event], [$this]);
        }

        return $result;
    }
947632
public function handle(Event $event)
    {
        $name = $event->getName();
        list(, $method) = explode('.', $name);
        if (empty($this->_config['for']) && empty($this->_config['when'])) {
            return $this->{$method}($event);
        }
        if ($this->matches($event)) {
            return $this->{$method}($event);
        }
    }
1292842
public function handleEventScriptEvent($event)
    {
        \Cache::forget(Cache::EVENT_SCRIPT_CACHE_PREFIX . $event->script->name);

        return true;
    }
49109
protected function handle($event): void
    {
        $method = $this->getApplyMethod($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
474615
public function dispatch($event) {
        if ( ! $event instanceof IEvent) {
            $event = $this->createEvent($event);
        }

        foreach ($this->subscriptions as $subscription) {
            if ( ! $event->isActive()) {
                return $event;
            }

            if ($subscription === null ||
                $subscription->getEventName() !== $event->getName()
            ) {
                continue;
            }

            $this->invokeSubscription($subscription, $event);
        }

        return $event;
    }
933677
public function trigger($event)
    {

        if (is_string($event)) {
            $event = new Event($event);
        }
        $listeners = $this->getListeners($event->name);

        if (empty($listeners)) {
            return $event;
        }

        //print_r($listeners);

        //die;

        //Priorities... the bigger the more urgent
        $urgency = ksort($listeners, SORT_NUMERIC);
        $callbacks = array_reverse($listeners, true);

        //Loop through callbacks;
        foreach ($callbacks as $priority => $listener) {
            if ($event->isStopped()) {
                break;
            }

            foreach ($listener as $callback) {
                if ($event->isStopped()) {
                    break;
                }
                $this->propergate($event, $callback);
            }
        }

        return $event;
    }
489769
public function off(string $event)
    {
        if (false === ($key = array_search($event, $this->getSupportedEvents(), true))) {
            return null;
        }

        if (!isset($this->eventHandlers[$key]) || !($cb = $this->eventHandlers[$key])) {
            return null;
        }

        $this->eventHandlers[$key] = null;

        return $cb;
    }
1072221
public function dispatch($event)
    {
        if ($event instanceof AbstractEvent) {
            $this->dispatcher->dispatch($event->getEventName(), $event);
        } else {
            $this->dispatcher->dispatch($event);
        }
        return $this;
    }