Check is listeners exists for current event.

if (Event::hasListeners('event_name')) {
// do something...
}

@access public
@param  string  $event       Event name
@return bool    $return      Return data or not. Default is false
777691
public static function hasListeners(string $event) : bool
    {
        if (! isset(Event::$listeners[$event]) || count(Event::$listeners[$event]) === 0) {
            return false;
        }

        return true;
    }
967166
public function getListeners(AbstractEvent $event, $asynchronous = false)
    {
        return array_filter(
            $this->listeners,
            function (EventListener $eventSubscriber) use ($asynchronous, $event) {
                $supportedEvent = $eventSubscriber->getEventClassName();

                if ($eventSubscriber->isAsynchronous() !== $asynchronous) {
                    return false;
                }
                if (null === $supportedEvent) {
                    return true;
                }

                return $event instanceof $supportedEvent;
            }
        );
    }
1149440
public function notify(Event $event)
    {
        $processed = false;
        foreach ($this->listeners as $listener) {
            if ($listener->match($event)) {
                $listener->handle($event);
                $processed = true;
                if ($event->isPropagationStopped()) {
                    break;
                }
            }
        }
        return $processed;
    }
695162
public function detach($event, $callback)
    {
        if (!isset($this->eventListeners[$event]) || $this->eventListeners[$event]->isEmpty()) {
            return false;
        }

        $removed = false;
        $listeners = $this->eventListeners[$event];
        $newListeners = new ListenerQueue();

        $listeners->setExtractFlags(ListenerQueue::EXTR_BOTH);
        foreach ($listeners as $item) {
            if ($item['data'] === $callback) {
                $removed = true;
                continue;
            }

            $newListeners->insert($item['data'], $item['priority']);
        }
        $listeners->setExtractFlags(ListenerQueue::EXTR_DATA);

        $this->eventListeners[$event] = $newListeners;

        return $removed;
    }
614918
public function getEventCallbacks($event = null)
    {
        if ($event === null) {
            return $this->eventCallbacks;
        }

        return $this->eventCallbacks[strtolower($event)] ?? [];
    }
838529
public function removeListener($listener, $event = null): bool
    {
        if ($event) {
            if ($event instanceof EventInterface) {
                $event = $event->getName();
            }

            // 存在对这个事件的监听队列
            if (isset($this->listeners[$event])) {
                $this->listeners[$event]->remove($listener);
            }
        } else {
            foreach ($this->listeners as $queue) {
                /**  @var $queue ListenerQueue */
                $queue->remove($listener);
            }
        }

        return true;
    }
1290733
public function hasListeners($eventName)
    {
        if ($listeners = $this->events->getListeners($eventName)) {
            return true;
        }

        if ($listeners = $this->events->getListeners($eventName, 'before')) {
            return true;
        }

        if ($listeners = $this->events->getListeners($eventName, 'after')) {
            return true;
        }

        return false;
    }
256812
public static function listen($event, $callback)
	{
		if (!isset(self::$events[$event])) {
			self::$events[$event] = array();
		}
		
		self::$events[$event][] = $callback;
		return true;
	}
642461
public static function isSupportedEvent(string $event): bool
    {
        if (!$event || !preg_match('/[a-zA-z][\w-]+/', $event)) {
            return false;
        }

        if ($ets = self::$supportedEvents) {
            return \in_array($event, $ets, true);
        }

        return true;
    }
370421
public function isListener($listener): bool
    {
        if (Assert::instanceOf($listener, '\\One\\Event\\OnceListener')) {
            $listener = $listener->getHandler();
        }

        return $this->handler === $listener;
    }
597850
public function listeners($event): array
    {
        $name = \get_class($event);

        $localListeners  = $this->events[$name] ?? [];
        $globalListeners = static::$globalEvents[$name] ?? [];

        return array_merge($globalListeners, $localListeners);
    }
70123
public function has_events($event)
	{
		if (isset($this->_events[$event]) and count($this->_events[$event]) > 0)
		{
			return true;
		}
		return false;
	}
204786
public function getListener($listener)
    {
        if (isset($this->listeners[$listener])) {
            return $this->listeners[$listener];
        }
        return false;
    }
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 ]);
	}
173206
function getListener(event, id) {
    if (hasListeners(event)) {
      var listeners = getListeners(event);

      if (_.has(listeners, id)) {
        return listeners[id];
      }
    }

    return false;
  }
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
            ));
        }
    }
151721
public function hasListeners($eventName)
    {
        return isset($this->listeners[$eventName]) || isset($this->wildcards[$eventName]);
    }