public static function formatPath($path)
    {
        if ($path == DIRECTORY_SEPARATOR) {
            return $path;
        }
        return trim($path) ? rtrim(trim($path), DIRECTORY_SEPARATOR) : '';
    }