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
Return values
mixed —componentEquals()
Tells whether the component value from both URI object equals.
private
static componentEquals(string $method, UriInterface|UriInterface $uri, UriInterface|UriInterface $base_uri) : bool
Parameters
- $method : string
- $uri : UriInterface|UriInterface
- $base_uri : UriInterface|UriInterface
Return values
bool —filterUri()
Filter the URI object.
private
static filterUri(mixed $uri) : void
Parameters
- $uri : mixed
-
an URI object
Tags
Return values
void —formatHost()
Filter the URI object.
private
static formatHost(UriInterface|UriInterface $uri) : UriInterface|UriInterface
Parameters
- $uri : UriInterface|UriInterface
Tags
Return values
UriInterface|UriInterface —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 —getComponent()
Returns the component value from the submitted URI object.
private
static getComponent(string $method, UriInterface|UriInterface $uri) : string|null
Parameters
- $method : string
- $uri : UriInterface|UriInterface
Return values
string|null —getSegments()
returns the path segments.
private
static getSegments(string $path) : array<string|int, string>
Parameters
- $path : string
Return values
array<string|int, string> —isRelativizable()
Tell whether the submitted URI object can be relativize.
private
static isRelativizable(UriInterface|UriInterface $uri, UriInterface|UriInterface $base_uri) : bool
Parameters
- $uri : UriInterface|UriInterface
- $base_uri : UriInterface|UriInterface
Return values
bool —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 —resolvePathAndQuery()
Resolve an URI path and query component.
private
static resolvePathAndQuery(UriInterface|UriInterface $uri, UriInterface|UriInterface $base_uri) : array{0: string, 1: string|null}
Parameters
- $uri : UriInterface|UriInterface
- $base_uri : UriInterface|UriInterface