public static function getNamespace($className)
    {
        if (is_object($className)) {
            $className = get_class($className);
        }
        if (strpos($className, '\\') === false) {
            return '';
        }
        return preg_replace('/\\\\[^\\\\]+$/', '', $className);
    }