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;
    }