@param string $path

@return string
768264
protected static function normalizePath($path)
    {
        if ('/' === substr($path, 0, 1)) {
            $path = static::removePathDotSegments($path);
        }

        $path = static::encodePath(
            static::decodeUrlEncodedChars(
                $path,
                '/[' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]/'
            )
        );

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

        return $path;
    }
428818
public function getRemainingPath($path)
	{
		$paths = explode('/', $path);
		
		$newPaths	= array();

		for($i = count(explode('/', $this->properties['path'])); $i < count($paths); $i++)
			$newPaths[]	= $paths[$i];

		return $this->properties['path'] != '' ? implode('/', $newPaths) : $path;
	}
1091208
public static function stripExt($path) {
        if (mb_strpos($path, '.') !== false) {
            $path = mb_substr($path, 0, mb_strrpos($path, '.'));
        }

        return $path;
    }
904030
protected function realpath(string $path): string
    {
        if ($path === '') {
            return $this->baseDir;
        }

        if ($path[0] === '/' || (!empty($path[1]) && $path[1] === ':')) {
            return $path;
        }

        return $this->baseDir . '/' . $path;
    }
468930
protected function getLicense(string $path): string
    {
        if (isset($this->licenseMap[$path])) {
            return $this->licenseMap[$path];
        }

        if (!file_exists($path . '.license')) {
            $this->licenseMap[$path] = '';
            return '';
        }

        $license = (string)file_get_contents($path . '.license');
        $this->licenseMap[$path] = $license;

        return $license;
    }
339132
public static function type(string $path): string
    {
        $result = @filetype($path);
        return $result !== false ? $result : '';
    }
120497
public static function dirname(string $path): string
    {
        $dirname = dirname($path);

        return self::normalizeDirname($dirname);
    }
760816
protected function makeSurePathIsAbsolute($path): string
    {
        $site_url = rtrim($this->getParameter('site_url'), '/') . '/';

        if (0 !== strpos($path, 'http')) {
            return $site_url . ltrim($path, '/');
        } else {
            return $path;
        }
    }
210192
public static function normalizePath(?string $path): string
  {
    // With thanks to monkeysuffrage, see https://github.com/monkeysuffrage/phpuri/blob/master/phpuri.php.

    if ($path===null || $path==='')
    {
      return '';
    }

    $normalized_path = $path;
    $normalized_path = preg_replace('`//+`', '/', $normalized_path, -1, $c0);
    $normalized_path = preg_replace('`^/\\.\\.?/`', '/', $normalized_path, -1, $c1);
    $normalized_path = preg_replace('`/\\.(/|$)`', '/', $normalized_path, -1, $c2);
    $normalized_path = preg_replace('`/[^/]*?/\\.\\.(/|$)`', '/', $normalized_path, 1, $c3);
    $_num_matches    = $c0 + $c1 + $c2 + $c3;

    return ($_num_matches>0) ? self::normalizePath($normalized_path) : $normalized_path;
  }
1014567
protected function _path($path) {
		if (($file = $this->stat($path)) == false) {
			return '';
		}
		
		$parentsIds = $this->getParents($path);
		$path = '';
		foreach ($parentsIds as $id) {
			$dir = $this->stat($id);
			$path .= $dir['name'].$this->separator;
		}
		return $path.$file['name'];
	}
906192
protected function sanitizePath($path)
    {
        if (empty($path)) {
            return '';
        }

        $path = Files::getUnixStylePath($path);
        if (is_dir($path)) {
            $path = Files::getNormalizedPath($path);
        }

        return $path;
    }
691290
public static function prefix(string $path = ''): string
    {
        $prefix = config('platform.prefix');

        return Str::start($prefix.$path, '/');
    }
227005
public static function url(string $path): string
    {
        return self::SCHEME . '://' . join(
                '/',
                array_map(
                        'rawurlencode',    // ensure singe path parts are correctly urlencoded
                        explode(
                                '/',
                                str_replace('\\', '/', $path)  // ensure correct directory separator
                        )
                )
        );
    }
192660
protected function realPath( $path )
    {
        $path = trim( str_replace( '\\', '/', $path ), '/' );
        $path = str_replace( '/./', '/', $path );
        $path = preg_replace( '#[^/]+/\\.\\./#', '/', $path );
        $path = preg_replace( '#/?\\.\\.?/#', '', $path );
        $path = preg_replace( '#/+#', '/', $path );
        $path = trim( $path, '/' );

        if ( $path == '.' || $path == '..' )
        {
            $path = '';
        }

        return $path;
    }
158930
public static function trimPath($path) {
		$len = strlen($path);
		if ($path[$len - 1] == '\\' || $path[$len - 1] == '/') {
			$path = substr($path, 0, $len - 1);
		}

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

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

        return $path;
    }
1058400
private function cleanPath($path)
  {
    $path = substr($path, 0, 1) == '/' ? substr($path, 1, strlen($path) - 1) : $path;
    $path = substr($path, strlen($path) - 1, 1) == '/' ? substr($path, 0, strlen($path) - 1) : $path;

    $path = substr($path, 0, 1) == '\\' ? substr($path, 1, strlen($path) - 1) : $path;
    $path = substr($path, strlen($path) - 1, 1) == '\\' ? substr($path, 1, strlen($path) - 1) : $path;

    $path = preg_replace('#' . $this->DS . '+#', $this->DS, $path);

    return $path;
  }