Documentation

UriResolver
in package

Table of Contents

DOT_SEGMENTS  = ['.' => 1, '..' => 1]
relativize()  : UriInterface|UriInterface
Relativize an URI according to a base URI.
resolve()  : UriInterface|UriInterface
Resolve an URI against a base URI using RFC3986 rules.
__construct()  : mixed
componentEquals()  : bool
Tells whether the component value from both URI object equals.
filterUri()  : void
Filter the URI object.
formatHost()  : UriInterface|UriInterface
Filter the URI object.
formatPath()  : string
Formatting the path to keep a valid URI.
formatPathWithEmptyBaseQuery()  : string
Formatting the path to keep a resolvable URI.
getComponent()  : string|null
Returns the component value from the submitted URI object.
getSegments()  : array<string|int, string>
returns the path segments.
isRelativizable()  : bool
Tell whether the submitted URI object can be relativize.
reducer()  : array<int, string>
Remove dot segments.
relativizePath()  : string
Relative the URI for a authority-less target URI.
removeDotSegments()  : string
Remove dot segments from the URI path.
resolvePathAndQuery()  : array{0: string, 1: string|null}
Resolve an URI path and query component.

Constants

DOT_SEGMENTS

public array<string, int> DOT_SEGMENTS = ['.' => 1, '..' => 1]

Methods

relativize()

Relativize an URI according to a base URI.

public static relativize(UriInterface|UriInterface $uri, UriInterface|UriInterface $base_uri) : UriInterface|UriInterface

This method MUST retain the state of the submitted URI instance, and return an URI instance of the same type that contains the applied modifications.

This method MUST be transparent when dealing with error and exceptions. It MUST not alter of silence them apart from validating its own parameters.

Parameters
$uri : UriInterface|UriInterface
$base_uri : UriInterface|UriInterface
Return values
UriInterface|UriInterface

resolve()

Resolve an URI against a base URI using RFC3986 rules.

public static resolve(UriInterface|UriInterface $uri, UriInterface|UriInterface $base_uri) : UriInterface|UriInterface

If the first argument is a UriInterface the method returns a UriInterface object If the first argument is a Psr7UriInterface the method returns a Psr7UriInterface object

Parameters
$uri : UriInterface|UriInterface
$base_uri : UriInterface|UriInterface
Return values
UriInterface|UriInterface

__construct()

private __construct() : mixed
Tags
codeCoverageIgnore
Return values
mixed

filterUri()

Filter the URI object.

private static filterUri(mixed $uri) : void
Parameters
$uri : mixed

an URI object

Tags
throws
TypeError

if the URI object does not implements the supported interfaces.

Return values
void

formatPath()

Formatting the path to keep a valid URI.

private static formatPath(string $path, string $basepath) : string
Parameters
$path : string
$basepath : string
Return values
string

formatPathWithEmptyBaseQuery()

Formatting the path to keep a resolvable URI.

private static formatPathWithEmptyBaseQuery(string $path) : string
Parameters
$path : string
Return values
string

getSegments()

returns the path segments.

private static getSegments(string $path) : array<string|int, string>
Parameters
$path : string
Return values
array<string|int, string>

reducer()

Remove dot segments.

private static reducer(array<string|int, mixed> $carry, string $segment) : array<int, string>
Parameters
$carry : array<string|int, mixed>
$segment : string
Return values
array<int, string>

relativizePath()

Relative the URI for a authority-less target URI.

private static relativizePath(string $path, string $basepath) : string
Parameters
$path : string
$basepath : string
Return values
string

removeDotSegments()

Remove dot segments from the URI path.

private static removeDotSegments(string $path) : string
Parameters
$path : string
Return values
string

Search results