public static function getNamespace($class)
    {
        if (!is_object($class) && !is_string($class)) {
            throw new InvalidArgumentException('$object must be a string or an object');
        }

        $class = (is_string($class) ? $class : get_class($class));
        $pos = strrpos($class, '\\');

        return substr($class, 0, $pos);
    }