src/Event.php
public static function off($class, $name, callable $handler = null)
    {
        $class = ObjectHelper::getClass($class);
        if ($handler === null) {
            unset(static::$events[$class][$name]);
            if (empty(static::$events[$class])) {
                unset(static::$events[$class]);
            }
            return true;
        }

        $removed = false;
        foreach (self::$events[$class][$name] as $i => $event) {
            if ($event === $handler) {
                unset(self::$events[$class][$name][$i]);
                $removed = true;
            }
        }
        if ($removed) {
            self::$events[$class][$name] = array_values(self::$events[$class][$name]);
        }

        return $removed;
    }
public static function off($class, $name, callable $handler = null)
    {
        $class = ObjectHelper::getClass($class);
        if ($handler === null) {
            unset(static::$events[$class][$name]);
            if (empty(static::$events[$class])) {
                unset(static::$events[$class]);
            }
            return true;
        }

        $removed = false;
        foreach (self::$events[$class][$name] as $i => $event) {
            if ($event === $handler) {
                unset(self::$events[$class][$name][$i]);
                $removed = true;
            }
        }
        if ($removed) {
            self::$events[$class][$name] = array_values(self::$events[$class][$name]);
        }

        return $removed;
    }
public static function off ( $ class , $ name , callable $ handler = null ) { $ class = ObjectHelper :: getClass ( $ class ) ; if ( $ handler === null ) { unset ( static :: $ events [ $ class ] [ $ name ] ) ; if ( empty ( static :: $ events [ $ class ] ) ) { unset ( static :: $ events [ $ class ] ) ; } return true ; } $ removed = false ; foreach ( self :: $ events [ $ class ] [ $ name ] as $ i => $ event ) { if ( $ event === $ handler ) { unset ( self :: $ events [ $ class ] [ $ name ] [ $ i ] ) ; $ removed = true ; } } if ( $ removed ) { self :: $ events [ $ class ] [ $ name ] = array_values ( self :: $ events [ $ class ] [ $ name ] ) ; } return $ removed ; }
Detach event.

@param string|object   $class   the fully qualified class name from which the event handler needs to be detached.
@param string   $name    name of event
@param callable $handler the event handler to be removed.
If it is null, all handlers attached to the named event will be removed.
@return bool
@see on()
Detach event .