是否存在(对事件的)监听器
@param $listener
@param  EventInterface|string $event
@return bool
972990
public function hasListener($listener, $event = null): bool
    {
        if ($event) {
            if ($event instanceof EventInterface) {
                $event = $event->getName();
            }

            if (isset($this->listeners[$event])) {
                return $this->listeners[$event]->has($listener);
            }
        } else {
            foreach ($this->listeners as $queue) {
                if ($queue->has($listener)) {
                    return true;
                }
            }
        }

        return false;
    }
1170649
public function onBefore($event, callable $listener)
    {

        if (strpos($event, '*') !== false) {
            $this->beforeAnyListeners[] = $this->toWildcardListener($event, $listener);
            return $this;
        }

        self::parentOnBefore($event, $listener);

        return $this;
    }
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;
    }
204786
public function getListener($listener)
    {
        if (isset($this->listeners[$listener])) {
            return $this->listeners[$listener];
        }
        return false;
    }
932761
public function removeListener(
        string $event,
        callable $listener
    )
    {
        if ($this->_events[$event] ?? false) {

            $key = array_search(
                $listener,
                $this->_events[$event],
                true
            );

            if ($key !== false) {

                array_splice(
                    $this->_events[$event],
                    $key,
                    1
                );
            }
        }

        return $this;
    }
316771
public function handle(EventInterface $event)
    {
        $events = array_filter($this->listener, function (string $eventName) use ($event): bool {
            return fnmatch($eventName, $event->getName());
        }, ARRAY_FILTER_USE_KEY);

        $events = array_reduce($events, 'array_merge', []);

        array_walk(
            $events,
            /**
             * @param mixed $item
             * @return void
             */
            function ($item) use ($event) {
                if ($item instanceof ListenerInterface) {
                    $item->handle($event);

                    return;
                }
                if (\is_callable($item)) {
                    $item($event);
                }
            }
        );
    }
594617
public function on($event, callable $listener)
    {

        if (strpos($event, '*') !== false) {
            $this->anyListeners[] = $this->toWildcardListener($event, $listener);
            return $this;
        }

        self::parentOn($event, $listener);

        return $this;
    }
227470
public function setEventListener($listener)
	{
		$this->ensureEventListeners();
		
		$this->_eventListeners[Ioc::resolveClassName($listener)] =  $listener;
		
		return $this;
	}
323503
public function countListeners($event)
	{
		$event = $this->resolveEventName($event);

		return isset($this->listeners[$event]) ? count($this->listeners[$event]) : 0;
	}
1244810
public function createClassListener($listener)
    {
        return function ($event, $payload) use ($listener) {
            return call_user_func_array($this->createClassCallable($listener), $payload);
        };
    }
388189
public function addListener($listener, $event, $prior = null)
    {
        if (!is_callable($event)) {
            return false;
        }

        if (!array_key_exists($listener, $this->listeners)) {
            $this->listeners[$listener] = [];
        }

        if (!$prior) {
            $this->listeners[$listener][] = $event;
        } else {
            array_splice($this->listeners[$listener], $prior, 0, $event);
        }

        return true;
    }
761575
public function subscribe(string $event, string $listener, callable $callback)
    {
        $callbackKey = $event . ' ' . $listener;
        $this->events[$event][] = $callbackKey;
        $this->subscriptions[$callbackKey] = $callback;
    }
1361291
public function attachListener(EventListener $listener)
    {
        foreach ($listener->getEventHandlers() as $name => $method) {
            if (! is_string($name)) {
                $name = $method;
                if (strpos($method, '.') !== false) {
                    $splits = explode('.', $method);
                    $method = $splits[count($splits) - 1];
                }
            }
            $this->attachHandler($name, array(
                $listener,
                $method
            ));
        }
    }
772233
public function handle(EventListenerInterface $listener)
    {
        if (!$listener->getListeners()) {
            return;
        }

        $content = $this->request->getContent();

        try {
            $options = Serializer::parse($content);
        } catch (\InvalidArgumentException $e) {
            $options = [];
        }

        foreach ($listener->getListeners() as $namespace => $callable) {
            $event = new $namespace($options);
            if ($event->isValid()) {
                $listener->trigger($namespace, $event);
                break;
            }
        }
    }
1072347
protected function removeListenerFromEvent(callable $listener, string $event) : interfaces\Emitter
    {
        foreach ($this->listeners[$event] as $priority => $listeners) {
            if (false !== $key = array_search($listener, $listeners, true)) {
                unset($this->listeners[$event][$priority][$key], $this->chain[$event]);
            }
        }

        return $this;
    }
899713
public function once($event, callable $listener)
    {
        parent::once($event, $listener);
        $this->stderr->once($event, $listener);
    }
625244
private function getListener($listener)
	{
		$listenerClassName = Ioc::resolveClassName($listener);
		if (!isset($this->_listenerInstances[$listenerClassName])) {
			if (!($listener instanceof EventListenerInterface)) {
				$listener = Ioc::createObject($listener);
			}
			$this->_listenerInstances[$listenerClassName] = $listener;
		}
		
		return $this->_listenerInstances[$listenerClassName];
	}