public static function concatenatePaths($paths)
    {
        // If paths are not provided as array, get the paths from methods' arguments
        if (!is_array($paths)) {
            $paths = func_get_args();
        }

        // No paths provided?
        // Nothing to do
        if (empty($paths)) {
            return '';
        }

        $concatenated = '';
        $firstWindowsBased = false;
        $separator = DIRECTORY_SEPARATOR;

        foreach ($paths as $path) {
            $path = trim($path);

            // Empty paths are useless
            if (empty($path)) {
                continue;
            }

            // Does the first path is a Windows-based path?
            if (Arrays::isFirstElement($paths, $path)) {
                $firstWindowsBased = Regex::isWindowsBasedPath($path);

                if ($firstWindowsBased) {
                    $separator = '\\';
                }
            }

            // Remove the starting / beginning directory's separator
            $path = self::removeStartingDirectorySeparator($path, $separator);

            // Removes the ending directory's separator
            $path = self::removeEndingDirectorySeparator($path, $separator);

            /*
             * If OS is Windows, first part of the concatenated path should be the first passed path,
             * because in Windows paths starts with drive letter, e.g. "C:", and the directory separator is not
             * necessary at the beginning.
             */
            if ($firstWindowsBased && empty($concatenated)) {
                $concatenated = $path;

                continue;
            }

            // Concatenate the paths / strings with OS-related directory separator between them (slash or backslash)
            $concatenated = sprintf('%s%s%s', $concatenated, $separator, $path);
        }

        return $concatenated;
    }