Resolves a URI reference in the context of a base URI and the opposite way.
Methods |
public
static
relativize
(
Psr\Http\Message\UriInterface
$base
,
Psr\Http\Message\UriInterface
$target
) Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) One use-case is to use the current request URI as base URI and then generate relative links in your documents $base = new Uri('http://example.com/a/b/'); This method also accepts a target that is already relative and will try to relativize it further. Only a echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
|
public
static
removeDotSegments
(
$path
) Removes dot segments from a path and returns the new path.
|
public
static
resolve
(
Psr\Http\Message\UriInterface
$base
,
Psr\Http\Message\UriInterface
$rel
) Converts the relative URI into a new URI that is resolved against the base URI.
|
Methods |
private __construct () |
private static getRelativePath ( Psr\Http\Message\UriInterface $base , Psr\Http\Message\UriInterface $target ) |
Methods |
private static getRelativePath ( Psr\Http\Message\UriInterface $base , Psr\Http\Message\UriInterface $target ) |
public
static
relativize
(
Psr\Http\Message\UriInterface
$base
,
Psr\Http\Message\UriInterface
$target
) Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) One use-case is to use the current request URI as base URI and then generate relative links in your documents $base = new Uri('http://example.com/a/b/'); This method also accepts a target that is already relative and will try to relativize it further. Only a echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well
|
public
static
removeDotSegments
(
$path
) Removes dot segments from a path and returns the new path.
|
public
static
resolve
(
Psr\Http\Message\UriInterface
$base
,
Psr\Http\Message\UriInterface
$rel
) Converts the relative URI into a new URI that is resolved against the base URI.
|