Stores a listener in the resolving array.

@param string   $abstract
@param callable $listener

@return self
511091
protected function storeResolvingListener($abstract, $listener)
    {
        if (!isset($this->resolvingListeners[$abstract])) {
            $this->resolvingListeners[$abstract] = [];
        }
        $this->resolvingListeners[$abstract][] = $listener;

        return $this;
    }
204786
public function getListener($listener)
    {
        if (isset($this->listeners[$listener])) {
            return $this->listeners[$listener];
        }
        return false;
    }
1004751
synchronized void addListener(final AbstractEventListener<?> listener) {
        if (null == listener) {
            throw new NullPointerException();
        }

        final String eventType = listener.getEventType();
        if (null == eventType) {
            throw new NullPointerException();
        }

        List<AbstractEventListener<?>> listenerList = listeners.get(eventType);
        if (null == listenerList) {
            listenerList = new ArrayList<>();
            listeners.put(eventType, listenerList);
        }

        listenerList.add(listener);
    }
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;
            }
        }
    }
700131
public function bindCallback(string $scope, string $abstract, callable $factory)
    {
        $this->validateScope(__METHOD__, $scope);

        if ($scope === self::SCOPE_INSTANCE_PER_RESOLVE) {
            $this->container->bind($abstract, $factory);
        } else {
            $this->container->singleton($abstract, $factory);
        }
    }
276153
public function resolving($abstract, Closure $callback = null)
    {
        if (is_string($abstract)) {
            $abstract = $this->getAlias($abstract);
        }

        if (is_null($callback) && $abstract instanceof Closure) {
            $this->globalResolvingCallbacks[] = $abstract;
        } else {
            $this->resolvingCallbacks[$abstract][] = $callback;
        }
    }
1108738
public function on(string $event, $listener)
    {
        if (empty($this->_events[$event])) {

            $this->_events[$event] = [$listener];
        }
        else {

            $this->_events[$event][] = $listener;
        }

        return $this;
    }
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;
    }
1277000
public function makeListener($listener)
    {
        if (is_string($listener)) {
            return $this->createClassListener($listener);
        }

        return function ($event, $payload) use ($listener) {
            return $listener(...array_values($payload));
        };
    }
81230
protected function fireResolvingCallbacks($abstract, $object)
	{
		$this->fireCallbackArray($object, $this->globalResolvingCallbacks);

		$this->fireCallbackArray(
			$object, $this->getCallbacksForType(
				$abstract, $object, $this->resolvingCallbacks
			)
		);

		$this->fireCallbackArray($object, $this->globalAfterResolvingCallbacks);

		$this->fireCallbackArray(
			$object, $this->getCallbacksForType(
				$abstract, $object, $this->afterResolvingCallbacks
			)
		);
	}
1122495
public function attachListener(string $event, callable $listener, int $priority = 1): ListenerHandler
    {
        if (! empty($this->availableEventNames) && ! \in_array($event, $this->availableEventNames, true)) {
            throw new \InvalidArgumentException("Unknown event name given: $event");
        }

        $handler = new DefaultListenerHandler($listener);

        $this->events[$event][((int) $priority) . '.0'][] = $handler;

        return $handler;
    }
347288
public function setListener($event, callable $listener)
    {
        if (!is_string($event) || empty($event)) {
            throw new \InvalidArgumentException('The event name is invalid');
        }

        $this->listeners[$event] = $listener;
    }
897217
static private function getListener($listener)
    {
        $listenerClassName = Ioc::resolveClassName($listener);
    	if (!isset(self::$_elInstances[$listenerClassName])) {
    		if (!($listener instanceof EventListenerInterface)) {
    			$listener = Ioc::createObject($listener);
    		}
    		self::$_elInstances[$listenerClassName] = $listener;
    	}
    	
    	return self::$_elInstances[$listenerClassName];
    }
1244810
public function createClassListener($listener)
    {
        return function ($event, $payload) use ($listener) {
            return call_user_func_array($this->createClassCallable($listener), $payload);
        };
    }
421028
public function afterResolving($abstract, Closure $callback = null)
    {
        if (is_string($abstract)) {
            $abstract = $this->getAlias($abstract);
        }

        if ($abstract instanceof Closure && is_null($callback)) {
            $this->globalAfterResolvingCallbacks[] = $abstract;
        } else {
            $this->afterResolvingCallbacks[$abstract][] = $callback;
        }
    }
938925
protected function ensureListener($listener): Listener
    {
        if (Assert::instanceOf($listener, '\\One\\Event\\Listener')) {
            return $listener;
        } elseif (Assert::instanceOf($listener, '\\Closure') || Assert::array($listener)) {
            return new Listener($listener);
        } elseif (Assert::string($listener)) {
            return Reflection::newInstance($listener);
        }

        throw new InvalidArgumentException(
            '`Listener` must be `array`, `Closure` or extends class `One\Event\Listener`'
        );
    }
116331
private function registerListener($event, callable $listener, $priority)
    {
        if (!isset($this->events[$event])) {
            $this->events[$event] = [];
        }

        if ($priority === null) {
            $this->events[$event][] = $listener;

            return;
        }

        array_splice($this->events[$event], (int) $priority, 0, [$listener]);
    }