public static function getFormatNamespace($namespace, $leadingBackslash = false, $closingBackslash = true)
    {
        $namespace = trim($namespace, '\\');

        // if it does not end with a backslash add it.
        if ($closingBackslash) {
            $namespace = sprintf('%s\\', $namespace);
        }

        // if it does not start with a backslash add it.
        if ($leadingBackslash) {
            $namespace = sprintf('\\%s', $namespace);
        }

        return $namespace;
    }