public static function normalize(UriInterface
$uri, int
$flags = self::PRESERVING_NORMALIZATIONS
): UriInterface
{ if ($flags & self::CAPITALIZE_PERCENT_ENCODING
) { $uri = self::
capitalizePercentEncoding($uri);
} if ($flags & self::DECODE_UNRESERVED_CHARACTERS
) { $uri = self::
decodeUnreservedCharacters($uri);
} if ($flags & self::CONVERT_EMPTY_PATH &&
$uri->
getPath() === ''
&& ($uri->
getScheme() === 'http' ||
$uri->
getScheme() === 'https'
) ) { $uri =
$uri->
withPath('/'
);
} if ($flags & self::REMOVE_DEFAULT_HOST &&
$uri->
getScheme() === 'file' &&
$uri->
getHost() === 'localhost'
) { $uri =
$uri->
withHost(''
);
}