public function detachTrigger(TriggerInterface $trigger, $eventNameOrClass)
    {
        $event = (string) $eventNameOrClass;

        if (isset($this->events[$event])) {
            foreach ($this->events[$event] as $priority => $triggers) {
                if (false !== ($key = array_search($trigger, $triggers, false))) {
                    unset($this->events[$event][$priority][$key]);
                }
            }
        }

        return $this;
    }