public static function path($url)
{
// remove line feeds and trailing whitespaces and path separators
$path = trim($url, " \t\r\n\v/\\");
$path = substr($path, strlen(self::SCHEME . '://'));
$path = str_replace('\\', '/', $path);
// replace double slashes with single slashes
$path = str_replace('//', '/', $path);
return rawurldecode($path);
}