Normalize the URI
Normalizing a URI includes removing any redundant parent directory or current directory references from the path (e.g. foo/bar/../baz becomes foo/baz), normalizing the scheme case, decoding any over-encoded characters etc.
Eventually, two normalized URLs pointing to the same resource should be equal even if they were originally represented by two different strings
Return type: | Uri |
---|
Convert the link to a relative link by substracting a base URI
This is the opposite of resolving a relative link - i.e. creating a relative reference link from an original URI and a base URI.
If the two URIs do not intersect (e.g. the original URI is not in any way related to the base URI) the URI will not be modified.
Parameters: | Uri|string – |
---|---|
Return type: | Uri |
Set the URI scheme
If the scheme is not valid according to the generic scheme syntax or is not acceptable by the specific URI class (e.g. ‘http’ or ‘https’ are the only acceptable schemes for the ZendUriHttp class) an exception will be thrown.
You can check if a scheme is valid before setting it using the validateScheme() method.
Parameters: | string – |
---|---|
Throws ExceptionInvalidUriPartException: | |
Return type: | Uri |
Set the URI host
Note that the generic syntax for URIs allows using host names which are not necessarily IPv4 addresses or valid DNS host names. For example, IPv6 addresses are allowed as well, and also an abstract “registered name” which may be any name composed of a valid set of characters, including, for example, tilda (~) and underscore (_) which are not allowed in DNS names.
Subclasses of Uri may impose more strict validation of host names - for example the HTTP RFC clearly states that only IPv4 and valid DNS names are allowed in HTTP URIs.
Parameters: | string – |
---|---|
Throws ExceptionInvalidUriPartException: | |
Return type: | Uri |