Registers new callback for given event

@param string $event
@param mixed $callback
435067
public function registerCallback($event, $callback)
    {
        $this->checkEventType($event);
        $this->events[$event][] = $callback;
    }
317931
public function wrap($event, $object, $callback)
    {
        $events = (array) $event;

        foreach($events as $e)
            $this->trigger("before{$e}", $object);

        call_user_func($callback, $object);

        foreach($events as $e)
            $this->trigger("after{$e}", $object);

        return $this;
    }
365320
public function unregisterEvent($event , $callback)
    {
        $eventManager = $this->getServiceLocator()->get(EventManager::CONFIG_ID);
        $eventManager->detach($event , $callback);
        $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager);
    }
408453
function off(string $event, $callback): bool
    {
        return $this->getEventEmitter()->off($event, $callback);
    }
1180721
public function register($event, $callback)
	{
		// check if this is a valid event type
		if ( ! isset($this->callbacks[$event]))
		{
			throw new \InvalidArgumentException($event.' is not a valid event');
		}

		// check if the callback is acually callable
		if ( ! is_callable($callback))
		{
			throw new \InvalidArgumentException('Callback passed is not callable');
		}

		// store it
		$this->callbacks[$event][] = $callback;
	}
572706
public function register(string $name, $callback) : Event
    {
        if (is_null($name)) {
            throw new \RuntimeException(sprintf('Event name cannot be empty in %s', __FUNCTION__));
        }

        if (is_null($callback)) {
            throw new \RuntimeException(sprintf('Empty parameter passed as callback in %s function', __FUNCTION__));
        }

        if (!isset($this->events[$name])) {
            $this->events[$name] = [];
        }

        if (!in_array($callback, $this->events[$name])) {
            $this->events[$name][] = $callback;
        }

        return $this;
    }
675423
public function trigger($event, \Closure $callback = null)
    {
        $results = [];

        if (!$event instanceof EventInterface) {
            $event = new Event($event);
        }

        if ($listeners = $this->getListeners($event->getName())) {
            foreach ($listeners as $listener) {
                $result = call_user_func($listener, $event);
                if ($result instanceof EventInterface) {
                    // Save result
                    $results[] = clone $result;

                    // Was the queue halted early ?
                    if ($result->isQueueHaltedEarly()) {
                        return $this;
                    }

                    if ($callback !== null) {
                        call_user_func($callback, $result);
                    }

                    // Was the queue halted ?
                    if ($result->isQueueHalted()) {
                        return $this;
                    }
                } else {
                    if ($callback !== null) {
                        call_user_func($callback, $result);
                    }
                }
            }
        }
        if ($results) {
            return $results;
        }

        return false;
    }
953948
protected function _bind(array $callback) {
		if (true === empty($callback)) {
			return false;
		}
		array_map(function ($cb) {
			parent::on($cb['event'], $cb['callback']);
		}, $callback);
	}
744599
protected static function registerObservableEvent(string $event, $callback): void
    {
        if (! isset(static::$dispatcher)) {
            return;
        }

        $event = (new static())->getObservableKey($event);

        static::$dispatcher->listen("{$event}: ".static::class, $callback);
    }
1168413
public function listen($event, $callback)
    {
        if (!isset($this->listeners[$event])) {
            $this->listeners[$event] = [];
        }

        $this->listeners[$event][] = $callback;
    }
886816
public function dispatchUntil(ActionEvent $event, callable $callback): void
    {
        foreach ($this->getListeners($event) as $listenerHandler) {
            $listener = $listenerHandler->getActionEventListener();
            $listener($event);

            if ($event->propagationIsStopped()) {
                return;
            }
            if ($callback($event) === true) {
                return;
            }
        }
    }
674449
public function subscribe($eventType, $callback)
    {
        $callback = $this->makeEventCallback($callback);
        if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
            $this->eventList[$eventType] = [];
        }
        array_push($this->eventList[$eventType], $callback);
        return $callback['id'];
    }
930434
public function on($event, \Closure $callback): void
    {
        // check if event is a single string and parse it to array single item
        if (!Any::isArray($event)) {
            $event = [$event];
        }
        
        foreach ($event as $item) {
            $this->events[$item][] = $callback;
        }
    }
148861
public function on(string $event, $callback)
    {
        if (! is_string($callback) && ! is_callable($callback)) {
            throw new InvalidArgumentException(
                'Invalid websocket callback. Must be a string or callable.'
            );
        }

        $this->callbacks[$event] = $callback;

        return $this;
    }
117963
public function on ($event, callable $callback)
	{
		if (!isset ($this->events[$event]))
		{
			$this->events[$event] = array ();
		}
		$this->events[$event][] = $callback;
	}
46803
protected function trigger(ServiceEvent $event, $callback = null)
	{
		return $this->getEventManager()->trigger($event, $callback);
	}
1154067
public function on($event, $callback, $first = false)
	{
		$this->register($event, $callback, $first);
	}