/** * @param RegisteredListener|Listener|Plugin $object */ public function unregister($object) { if ($object instanceof Plugin or $object instanceof Listener) { $changed = \false; foreach ($this->handlerSlots as $priority => $list) { foreach ($list as $hash => $listener) { if ($object instanceof Plugin and $listener->getPlugin() === $object or $object instanceof Listener and $listener->getListener() === $object) { unset($this->handlerSlots[$priority][$hash]); $changed = \true; } } } if ($changed === \true) { $this->handlers = \null; } } elseif ($object instanceof RegisteredListener) { if (isset($this->handlerSlots[$object->getPriority()][\spl_object_hash($object)])) { unset($this->handlerSlots[$object->getPriority()][\spl_object_hash($object)]); $this->handlers = \null; } } }