UriFactory
in package
implements
UriFactoryInterface
Table of Contents
Interfaces
Methods
- createFromSapi() : Uri
- Create a Uri instance based on the headers and $_SERVER data.
- createUri() : UriInterface
- Create a new URI.
- getHeaderFromArray() : string|T
- Retrieve a header value from an array of headers using a case-insensitive lookup.
- marshalHostAndPort() : array{: string, : int|null}
- Marshal the host and port from the PHP environment.
- marshalHttpsValue() : bool
- marshalIpv6HostAndPort() : array{: string, : int|null}
- marshalRequestPath() : string
- Detect the path for the request
Methods
createFromSapi()
Create a Uri instance based on the headers and $_SERVER data.
public
static createFromSapi(array<non-empty-string, array<int, string>|int|float|string> $server, array<string, string|array<int, string>> $headers) : Uri
Parameters
- $server : array<non-empty-string, array<int, string>|int|float|string>
-
SAPI parameters
- $headers : array<string, string|array<int, string>>
Return values
UricreateUri()
Create a new URI.
public
createUri([string $uri = '' ]) : UriInterface
Parameters
- $uri : string = ''
Return values
UriInterfacegetHeaderFromArray()
Retrieve a header value from an array of headers using a case-insensitive lookup.
private
static getHeaderFromArray(string $name, array<string, string|array<int, string>> $headers[, T $default = null ]) : string|T
Parameters
- $name : string
- $headers : array<string, string|array<int, string>>
-
Key/value header pairs
- $default : T = null
-
Default value to return if header not found
Tags
Return values
string|TmarshalHostAndPort()
Marshal the host and port from the PHP environment.
private
static marshalHostAndPort(array<string|int, mixed> $server, array<string, string|array<int, string>> $headers) : array{: string, : int|null}
Parameters
- $server : array<string|int, mixed>
- $headers : array<string, string|array<int, string>>
Return values
array{: string, : int|null} —Array of two items, host and port, in that order (can be passed to a list() operation).
marshalHttpsValue()
private
static marshalHttpsValue(mixed $https) : bool
Parameters
- $https : mixed
Return values
boolmarshalIpv6HostAndPort()
private
static marshalIpv6HostAndPort(array<string|int, mixed> $server, int|null $port) : array{: string, : int|null}
Parameters
- $server : array<string|int, mixed>
- $port : int|null
Return values
array{: string, : int|null} —Array of two items, host and port, in that order (can be passed to a list() operation).
marshalRequestPath()
Detect the path for the request
private
static marshalRequestPath(array<string|int, mixed> $server) : string
Looks at a variety of criteria in order to attempt to autodetect the base request path, including:
- IIS7 UrlRewrite environment
- REQUEST_URI
- ORIG_PATH_INFO
Parameters
- $server : array<string|int, mixed>