Adds new listener.

@param  \Denpa\Bitcoin\ZeroMQ\Listener  $listener

@return void
356875
public function add(Listener $listener) : void
    {
        if ($this->open) {
            $listener->listenOn($this->zeromq);
        }
    }
204786
public function getListener($listener)
    {
        if (isset($this->listeners[$listener])) {
            return $this->listeners[$listener];
        }
        return false;
    }
929500
public function addListener( $eventName, IListener $listener, $priority = 0 )
    {
        $this->listeners[ $eventName ][ $priority ][ ] = $listener;

        unset( $this->_sorted[ $eventName ] );
    }
1059495
public function listen($events, $listener, $priority = 0)
    {
        if ($priority === 0) {
            $this->events->on($events, $listener);
            return;
        }

        if ($priority > 5) {
            $this->events->onBefore($events, $listener);
            return;
        }

        $this->events->onAfter($events, $listener);

    }
375459
public function addListenerByClass(string $class, $listener)
    {
        $class = trim($class, '\\');

        if (!isset($this->classListeners[$class])) {
            $this->classListeners[$class] = [];
        }
        $this->classListeners[$class][] = $listener;
    }
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 ]);
	}
227470
public function setEventListener($listener)
	{
		$this->ensureEventListeners();
		
		$this->_eventListeners[Ioc::resolveClassName($listener)] =  $listener;
		
		return $this;
	}
327930
protected function listen()
    {
        $events = app('events');
        if (isset($this->listen)) {
            foreach ($this->listen as $event => $listeners) {
                foreach ($listeners as $listener) {
                    $events->listen($event, $listener);
                }
            }
        }
        
        if (isset($this->subscribe)) {
            foreach ($this->subscribe as $subscriber) {
                $events->subscribe($subscriber);
            }
        }
    }
249558
protected function setOutputHandler(Listener $listener)
    {
        $listener->setOutputHandler(function ($type, $line) {
            $this->output->write($line);
        });
    }
1277000
public function makeListener($listener)
    {
        if (is_string($listener)) {
            return $this->createClassListener($listener);
        }

        return function ($event, $payload) use ($listener) {
            return $listener(...array_values($payload));
        };
    }
785401
public function listen($events, $listener, $priority = 0)
	{
		foreach ((array) $events as $event)
		{
			if (str_contains($event, '*'))
			{
				return $this->setupWildcardListen($event, $listener);
			}

			$this->listeners[$event][$priority][] = $this->makeListener($listener);

			unset($this->sorted[$event]);
		}
	}
1068128
public function addOperationListener(OperationListenerInterface $listener, $priority = 0)
    {
        $this->getEventManager()->attach('beforeOperation', [$listener, 'beforeOperation'], $priority);
        $this->getEventManager()->attach('afterOperation', [$listener, 'afterOperation'], $priority);
        $this->getEventManager()->attach('onOperationException', [$listener, 'onOperationException'], $priority);
    }
173191
public function addEntityChangedListener(EntityChangedListenerInterface $listener)
    {
        if (!$this->listeners->hasItem($listener)) {
            $this->listeners->push($listener);
        }
    }
1045575
public void add(Listener listener) {
        logger.trace("Adding listener [{}]", listener);
        synchronized (listeners) {
            listeners.add(listener);
        }
    }
890347
public synchronized void addListener(Listener<R> listener) {
        // it might be we add a listener AFTER the result is actually produced,
        // in which case we simply inform the listener immediately.
        if (isReady()) {
            if (_error != null) {
                listener.onError(_error);
            } else {
                listener.onSuccess(_result);
            }
            return;
        }

        if (_listeners == null) {
            _listeners = new LinkedList<>();
        }
        _listeners.add(listener);
    }
538798
public void addFirstListener(RunListener listener) {
        if (listener == null) {
            throw new NullPointerException("Cannot add a null listener");
        }
        listeners.add(0, wrapIfNotThreadSafe(listener));
    }
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
            ));
        }
    }