Unregister/remove one or all callbacks from event

@param   string   $event     event to remove from
@param   mixed    $callback  callback to remove [optional, null for all]
@return  boolean  wether one or all callbacks have been removed
963406
public function unregister($event, $callback = null)
	{
		if (isset($this->_events[$event]))
		{
			if ($callback === null)
			{
				unset($this->_events[$event]);
				return true;
			}

			foreach ($this->_events[$event] as $i => $arguments)
			{
				if($callback === $arguments[1])
				{
					unset($this->_events[$event][$i]);
					return true;
				}
			}
		}

		return false;
	}
40574
public function unregister($event=null)
    {
        if(!empty($event) && $event != '*')
            $this->_handlers[$event] = array();
        else
            $this->_handlers = array();

        return $this;
    }
723270
public function clearEventHandlers($event = null)
    {
        if (!empty($event)) {
            $this->events[$event] = [];
        } else {
            $this->events = [];
        }
    }
573385
public function removeReturnListener(callable $callback)
    {
        foreach ($this->returnCallbacks as $k => $v) {
            if ($v === $callback) {
                unset($this->returnCallbacks[$k]);
            }
        }

        return $this;
    }
283874
protected function propergate(&$event, $callback)
    {

        //Pass the event, the data can be obtained from $event->data;
        $result = call_user_func($callback['callable'], $event, $callback['params']);

        //Result false can be indication of an error?
        if ($result === false) {
            $event->stop();
        }

        //Anything new to say?
        if ($result !== null) {
            $event->setResult($result);
        }
    }
192737
public function unRegisterEvents()
    {
        if (is_array($this->events()) && count($this->events()))
        {
            $event = new Event($this);
            return $event->remove();
        }
        return true;
    }
529244
public function unsubscribe($eventType, $callbackId)
    {
        $success = false;
        if (!isset($this->eventList[$eventType]) || !is_array($this->eventList[$eventType])) {
            $this->eventList[$eventType] = array_filter(
                $this->eventList[$eventType],
                function ($cb) use ($callbackId) {
                    return $cb['id'] !== $callbackId;
                }
            );
            $success = true;
        }
        return $success;
    }
1019365
public function removeListener($event, $listener)
    {
        // shortcut to only remove a listener if they exist
        // having this allows us to simplify calling code
        if( !isset($listener) ) {
            return $this;
        }

        // listeners
        if (isset($this->listeners[$event])) {
            if (false !== ($key = array_search($listener, $this->listeners[$event]))) {
                unset($this->listeners[$event][$key]);
            }
            if( !$this->listeners[$event] ) {
                unset( $this->listeners[$event] );
            }
        }
        // listeners once
        if (isset($this->listenersOnce[$event])) {
            if (false !== ($key = array_search($listener, $this->listenersOnce[$event]))) {
                unset($this->listenersOnce[$event][$key]);
            }
            if( !$this->listenersOnce[$event] ) {
                unset( $this->listenersOnce[$event] );
            }
        }
        return $this;
    }
154428
function clearEventHandlers($event = null)
	{
		if (!empty($event)) {
			$this->_events[$event] = array();
		}
		else {
			$this->_events = array();
		}
	}
601024
public function removeListener($event, $callback)
    {
        if (false === isset($this->listeners[$event])) {

            return;
        }

        $key = array_search($callback, $this->listeners[$event]);
        if ($key !== false) {
            unset($this->listeners[$event][$key]);

            if (0 === count($this->listeners[$event])) {
                unset($this->listeners[$event]);
            }
        }
    }
12104
function deleteListener(event, callback, idx) {
  if ((idx = event.listeners.indexOf(callback)) >= 0) {
    event.listeners.splice(idx, 1);
    event.meta.delete(callback);
    return true;
  }
  return false;
}
1364130
public function removeEvent($event) {
		$result = remove_entity_relationship($event->guid, self::EVENT_CALENDAR_RELATIONSHIP, $this->guid);

		if ($result) {
			// allow events to fire after confirmation that it has been added to the calendar
			elgg_trigger_event('events_api', 'remove_from_calendar', array('event' => $event, 'calendar' => $this));
		}

		return $result;
	}
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;
        }
    }
1273095
public function removeEvent($event, $table = ':any')
    {
        if ($table != ':any') {
            $table = $this->addTablePrefix($table, false);
        }

        return $this->connection->getEventHandler()->removeEvent($event, $table);
    }
782675
def remove_callback(self, callback) -> None:
        """"""
        if callback in self._callbacks:
            self._callbacks.remove(callback)
659306
public function registerEvent($event, $callback)
    {
        $eventManager = $this->getServiceLocator()->get(EventManager::CONFIG_ID);
        $eventManager->attach($event, $callback);
        $this->getServiceManager()->register(EventManager::CONFIG_ID, $eventManager);
    }
363598
public function removeListener($event, $listener)
    {
        if (! $this->hasListener($event)) {
            return;
        }

        $event = $this->getEventName($event);
        $listeners = $this->listeners[$event];

        foreach ($listeners as $priority => $registed) {
            $listeners[$priority] = array_filter($registed, function ($reg) use ($listener) {
                return ! $reg->isListener($listener);
            });
        }

        $this->listeners[$event] = $listeners;

        unset($this->sortedListeners[$event], $listeners, $event);
    }