Detaches a listener from an event

@param string $event the event to attach too
@param callable $callback a callable function
@return bool true on success false on failure
494872
public function detach(string $event, $callback){
        if(isset($this->listeners[$event])){
            return $this->listeners[$event]->remove($callback);
        }
        return false;
    }
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;
        }
    }
1159611
def unlisten(self, event, callback):
        
        try:
            self.listeners[event].remove(callback)
        except ValueError:
            return False
        else:
            return True
1036640
function detach() {
	        if ( w3c ) {
	            doc[REMOVEEVENTLISTENER]( DOMCONTENTLOADED, completed, FALSE );
	            win[REMOVEEVENTLISTENER]( LOAD, completed, FALSE );
	        } else {
	            doc[DETACHEVENT]( ONREADYSTATECHANGE, completed );
	            win[DETACHEVENT]( ONLOAD, completed );
	        }
	    }
1292661
private function ensureCallback($handler, $event)
    {
        if (!is_callable($handler)) {
            if (is_object($handler)) {
                if (!$handler instanceof \Closure) {
                    $handler = [$handler, $event];
                }
            }
            if (!is_callable($handler)) {
                throw new EventHandlerException("Handler is not callable for event {$event}");
            }
        }

        return $handler;
    }
319613
function removeListener(string $event, callable $listener) {
        if(isset($this->listeners[$event])) {
            $index = \array_search($listener, $this->listeners[$event], true);
            if($index !== false) {
                unset($this->listeners[$event][$index]);
                if(\count($this->listeners[$event]) === 0) {
                    unset($this->listeners[$event]);
                }
            }
        }
        
        if(isset($this->onceListeners[$event])) {
            $index = \array_search($listener, $this->onceListeners[$event], true);
            if($index !== false) {
                unset($this->onceListeners[$event][$index]);
                if(\count($this->onceListeners[$event]) === 0) {
                    unset($this->onceListeners[$event]);
                }
            }
        }
        
        return $this;
    }
408453
function off(string $event, $callback): bool
    {
        return $this->getEventEmitter()->off($event, $callback);
    }
774465
protected function removeObserversByEvent(string $event, callable $callback): EventInterface
    {
        //if event isn't set
        if (!isset($this->observers[$event])) {
            //do nothing
            return $this;
        }

        //'foobar' => array(
        foreach ($this->observers[$event] as $i => $observer) {
            //0 => callback
            if ($observer['observer']->assertEquals($callback)) {
                unset($this->observers[$event][$i]);
            }
        }

        return $this;
    }
319717
public static function off($name, $callback = null)
    {
        if (empty(self::$events[$name])) {
            return null;
        } elseif ($callback === null) {
            self::$events[$name] = array();
            return null;
        }

        $evts = self::$events[$name];

        foreach ($evts as $key => $value) {
            if ($value[0] === $callback) {
                unset($evts[$key]);
            }
        }

        self::$events[$name] = $evts;
        $evts = null;
    }
544102
protected function removeObserversByCallback(callable $callback): EventInterface
    {
        //find the callback
        foreach ($this->observers as $event => $observer) {
            $this->removeObserversByEvent($event, $callback);
        }

        return $this;
    }
1136699
public function bind(string $event, callable $callback) {
        // We can't bind to something that isn't callable
        if (!is_callable($callback)) {
            return false;
        }

        if (!isset($this->bindings[$event]) || !is_array($this->bindings[$event])) {
            $this->bindings[$event] = [];
        }

        // Check if this event is already registered
        $signature = $this->hash($callback);
        if (array_key_exists($signature, $this->bindings[$event])) {
            return $signature;
        }

        $this->bindings[$event][$signature] = $callback;
        return $signature;
    }
50868
public function onAfter($event, callable $listener)
    {
        $this->checkEvent($event);

        if (!isset($this->afterListeners[$event])) {
            $this->afterListeners[$event] = [];
        }
        $this->afterListeners[$event][] = $listener;

        return $this;
    }
913138
public function hasListener($event): bool
    {
        $name = $this->getEventName($event);

        if (isset($this->listeners[$name])) {
            foreach ($this->listeners[$name] as $listeners) {
                if (count($listeners) > 0) {
                    return true;
                }
            }
        }

        unset($name);

        return false;
    }
804147
public static function listen(string $event, callable $callback) {
		if (!isset(self::$events[$event])) {
			self::$events[$event] = [];
		}
		self::$events[$event][] = $callback;
	}
1082221
protected function convertEvent($event)
    {
        if ($event instanceof OriginalCallbackEvent) {
            return new CallbackEvent($event);
        }

        if ($event instanceof OriginalEvent) {
            return new Event($event);
        }

        return $event;
    }
131137
public function off(string $event): bool
    {
        if ($this->hasEvent($event)) {
            unset(self::$events[$event], self::$eventHandlers[$event]);

            return true;
        }

        return false;
    }
1035040
public function detach($eventName, callable $handler)
    {
        if (isset($this->events[$eventName])) {
            $this->events[$eventName]->remove($handler);
            if (0 == count($this->events[$eventName])) {
                unset($this->events[$eventName]);
            }
        }
    }