public static function mergePaths($pathOrPaths, ...$additionalPaths)
    {
        if (is_array($pathOrPaths)) {
            $paths = $pathOrPaths;
        } else {
            $paths = array_merge([$pathOrPaths], $additionalPaths);
        }

        $paths = array_values($paths);

        $prefix = "";
        $suffix = "";
        if (count($paths) > 0) {
            // Save root for first path
            if (self::startsWith($paths[0], ["/", "\\"])) {
                $prefix = "/";
            }

            // Save separator for last path
            if (self::endsWith($paths[count($paths) - 1], ["/", "\\"])) {
                $suffix = "/";
            }
        }

        // Remove leading and trailing separators from parts to not end up with repeated separators (or root by non-first argument and empty root)
        array_walk($paths, function(&$path) {
            $path = str_replace("\\", "/", $path);
            $path = trim($path, "/");
        });

        // Remove empty parts to not end up with repeated separators
        $paths = array_filter($paths);

        $path = implode("/", $paths);

        // Only add suffix if there is a path, to prevent suffix from making root
        if ($path) {
            $path .= $suffix;
        }

        return $prefix . $path;
    }