Count the number of registered listeners for the given event.

@param   EventInterface|string  $event  The event object or name.
@return  integer  The number of registered listeners for the given event.
323503
public function countListeners($event)
	{
		$event = $this->resolveEventName($event);

		return isset($this->listeners[$event]) ? count($this->listeners[$event]) : 0;
	}
1111225
public function eventTriggered($event)
    {
        $event = $this->normalizeEvent($event);

        foreach ($this->triggeredEvents as $triggeredEvent) {
            if ($event == $triggeredEvent || is_subclass_of($event, $triggeredEvent)) {
                return true;
            }
        }

        return false;
    }
955190
protected function execute($event)
    {
        foreach($this->events[$event] as $handler) {
            $this->listen($event, $handler);
        }
    }
70123
public function has_events($event)
	{
		if (isset($this->_events[$event]) and count($this->_events[$event]) > 0)
		{
			return true;
		}
		return false;
	}
811772
static public function trigger(string $event, array $args = [], bool $delete = true, $newthis = null): int {
		if(!self::exists($event)) return 0;
        

        foreach(self::$listeners[$event] as $listener) {
            static $count = 0;

            if($newthis) $listener = $listener->bindTo($newthis);
            $listener(...$args);

            $count++;
        }

        if($delete) self::delete($event);
		return $count;
	}
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;
	}
923050
private function getListenersForEvent($event) {
        $listeners = [];

        foreach ($this->getEventNameParts($event) as $name) {
            if (isset($this->callbacks[$name])) {
                foreach (clone $this->callbacks[$name] as $listener) {
                    $listeners[] = $listener;
                }
            }
        }

        return $listeners;
    }
692222
public function add(EventInterface $event)
    {
        $index = $this->computeIndex($event);
        if (isset($this->events[$index])) {
            $this->events[$index][] = $event;
        } else {
            $this->events[$index] = array($event);
        }

        ++$this->count;
    }
1092036
public function hasListenerQueue($event): bool
    {
        if ($event instanceof EventInterface) {
            $event = $event->getName();
        }

        return isset($this->listeners[$event]);
    }
154732
public function clearListeners($event = null)
	{
		if ($event)
		{
			$event = $this->resolveEventName($event);

			if (isset($this->listeners[$event]))
			{
				unset($this->listeners[$event]);
			}
		}
		else
		{
			$this->listeners = array();
		}

		return $this;
	}
1374373
public static function emit($event)
    {
        if (isset(static::$events['__bow.once.event'][$event])) {
            $listener = static::$events['__bow.once.event'][$event];

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

            return $listener->call($data);
        }

        if (!static::bound($event)) {
            return false;
        }

        if (isset(static::$events[$event])) {
            $events = static::$events[$event];
        } else {
            $events = static::$events['__bow.transmission.event'][$event];
        }

        $listeners = new Collection($events);

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

        $listeners->each(function (Listener $listener) use ($data) {

            if ($listener->getActionType() === 'string') {
                $callable = $listener->getAction();
            } else {
                $callable = [$listener, 'call'];
            }

            return Actionner::getInstance()->execute($callable, [$data]);
        });

        return true;
    }
1135083
public function listen($event,$listener){
        $listers_of_event = isset($this->listeners[$event]) ? $this->listeners[$event] : array();
        if (!in_array($listener,$listers_of_event,true)){
            $listers_of_event[] = $listener;
            $this->listeners[$event] = $listers_of_event;
        }
    }
476882
public function getListenerPriority($listener, $event)
	{
		$event = $this->resolveEventName($event);

		if (isset($this->listeners[$event]))
		{
			return $this->listeners[$event]->getPriority($listener);
		}

		return null;
	}
873759
protected function getEventName($event)
    {
        if (Assert::instanceOf($event, '\\One\\Event\\Event')) {
            return $event->getName();
        } elseif (Assert::string($event)) {
            return $event;
        }

        throw new InvalidArgumentException(
            '`Event` must be `string` or extends class `One\Event\Event`'
        );
    }
274190
public function listenersOfEvent(Event $event)
    {
        $event_name = get_class($event);

        return isset($this->listeners[$event_name]) ? $this->listeners[$event_name] : [];
    }
1215012
public function dispatch(Event $event): int {
        /** @var array $listeners */
        $listeners = $this->_events["$event"] ?? [];
        $i = 0;
        foreach ($listeners as $listener) {
            $callback = $listener['callback'];
            if (is_callable($callback)) {
                $event->state = $listener['state'];
                $callback($event);
                $i++;
                if ($event->isAttachingStopped()) {
                    return $i;
                }
            }
        }

        return $i;
    }
151228
public function getListenerPriority($listener, $event)
    {
        if ($event instanceof EventInterface) {
            $event = $event->getName();
        }

        if (isset($this->listeners[$event])) {
            return $this->listeners[$event]->getPriority($listener);
        }

        return null;
    }