Normalizes the supplied path

@param string $path

@return string
346859
public static function normalize(string $path) : string
    {
        if (strpos($path, 'data://') === 0) {
            return $path;
        }


        $path = self::stringReplaceIgnoringStreamWrapper(['\\', '/'], DIRECTORY_SEPARATOR, $path);

        $startOfPath = strpos($path, '://') === false ? 0 : strpos($path, '://') + strlen('://');

        while (strpos($path, DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $startOfPath) !== false) {
            $path = self::stringReplaceIgnoringStreamWrapper(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, $path);
        }

        return $path;
    }
737527
private function normalizePipePath($path)
    {
        // Prepend slash if missing
        if (empty($path) || $path[0] !== '/') {
            $path = '/' . $path;
        }

        // Trim trailing slash if present
        if (strlen($path) > 1 && '/' === substr($path, -1)) {
            $path = rtrim($path, '/');
        }

        return $path;
    }
1332184
protected function normalizePath($path)
    {
        if (preg_match("/^id:.*|^rev:.*|^(ns:[0-9]+(\/.*)?)/", $path) === 1) {
            return $path;
        }

        $path = (trim($path, '/') === '') ? '' : '/'.$path;

        return str_replace('//', '/', $path);
    }
1173086
private function normalizePath($path)
    {
        $path = rtrim($path, '/');

        if (empty($path) or '/' !== substr($path, 0, 1)) {
            $path = '/';
        }

        return $path;
    }
440127
protected function relativizePath(string $path): string
    {
        $base_segments = $this->getSegments($this->base_uri->getPath());
        $target_segments = $this->getSegments($path);
        $target_basename = array_pop($target_segments);
        array_pop($base_segments);
        foreach ($base_segments as $offset => $segment) {
            if (!isset($target_segments[$offset]) || $segment !== $target_segments[$offset]) {
                break;
            }
            unset($base_segments[$offset], $target_segments[$offset]);
        }
        $target_segments[] = $target_basename;

        return $this->formatPath(
            str_repeat('../', count($base_segments)).implode('/', $target_segments)
        );
    }
586261
private static function normalizerPath($path, $isfolder = false)
    {
        if (preg_match('/^\//', $path) == 0) {
            $path = '/'.$path;
        }

        if ($isfolder == true) {
            if (preg_match('/\/$/', $path) == 0) {
                $path = $path.'/';
            }
        }

        return $path;
    }
1311699
public static String normalizePath(String path) {
		String retval = path;
		retval = retval.replaceAll(PathUtils.REGEX_MULTIPLE_SLASH,
				PathUtils.REGEX_SLASH);
		retval = retval.replaceAll(PathUtils.REGEX_BACKSLASH,
				PathUtils.REGEX_SLASH);
		return retval;
	}
220344
protected function sanitizePath($path)
    {
        $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);

        $path = preg_replace('/'.preg_quote('./', '/').'/', '', $path, 1);
        $path = trim($path, '/');

        return $path;
    }
1368373
private String normalizePath(String path) {
		// remove double slashes & backslashes
		path = path.replace("//", "/");
		path = path.replace("\\", "/");

		return path;
	}
816263
protected static function normalizePath($path)
    {
        $normalized = str_replace(['\\', '/'], PHP_DS, (string) $path);

        return rtrim($normalized, PHP_DS);
    }
109151
private function normalizePath(): string
    {
        $path = $this->path;
        if (substr($path, -1) === '$') {
            $path = substr($path, 0, strlen($path) - 1);
        }

        if (substr($path, -1) === '?') {
            $path = substr($path, 0, strlen($path) - 1);
        }

        return $path;
    }
571982
private function normalizePath($path)
    {
        $path = explode('/', $path);

        array_walk($path, function (&$item) { $item = ucfirst($item); });

        return implode('/', $path);
    }
651312
static public function normalizePath($path)
    {
        $path = preg_replace('|/\./|', '/', $path);   // entferne /./
        $path = preg_replace('|^\./|', '', $path);    // entferne ./ am Anfang
        $i = 0;
        while (preg_match('|[^/]+/\.{2}/|', $path) && $i < 10) {
            $path = preg_replace_callback('|([^/]+)(/\.{2}/)|', function($matches){
                return ($matches[1] == '..' ? $matches[0] : '');
            }, $path);
            $i++;
        }
        return $path;
    }
1198283
public static function normalizePath(string $path): string
    {
        if (substr($path, 0, 1) == DIRECTORY_SEPARATOR) {
            return $path;
        }

        return getcwd().DIRECTORY_SEPARATOR.$path;
    }
789861
protected function normalizePath(string $path): string
    {
        $path = str_replace('\\', '/', $path);
        $path = $this->removePathWhiteSpace($path);

        $parts = [];

        foreach (explode('/', $path) as $part) {
            switch ($part) {
                case '':
                case '.':
                    break;

                case '..':
                    if (empty($parts)) {
                        throw new FileSystemException($path, 'The path is outside the root directory: "%s"');
                    }
                    array_pop($parts);
                    break;

                default:
                    $parts[] = $part;
                    break;
            }
        }

        return implode('/', $parts);
    }
626702
public static function normalize(string $path):string
    {
        $path = str_replace('\\', '/', $path);
        $prefix = static::prefix($path);
        $path = substr($path, strlen($prefix));
        $parts = array_filter(explode('/', $path), 'strlen');
        $tokens = array();
        foreach ($parts as $part) {
            switch ($part) {
                case '.':
                    break;
                case '..':
                    if (0 !== count($tokens)) {
                        array_pop($tokens);
                    }

                    break;
                default:
                    $tokens[] = $part;
            }
        }
        return $prefix . implode('/', $tokens);
    }
1170637
protected function normalizeFilename($path)
	{
		if (file_exists($path)) {
			$path = realpath($path);
		}
		return substr($path,mb_strlen(realpath(dirname($_SERVER['DOCUMENT_ROOT']))));
	}