ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
PSR-7 URI implementation. More...
Public Member Functions | |
__construct ($uri='') | |
__toString () | |
Return the string representation as a URI reference. More... | |
getScheme () | |
Retrieve the scheme component of the URI. More... | |
getAuthority () | |
Retrieve the authority component of the URI. More... | |
getUserInfo () | |
Retrieve the user information component of the URI. More... | |
getHost () | |
Retrieve the host component of the URI. More... | |
getPort () | |
Retrieve the port component of the URI. More... | |
getPath () | |
Retrieve the path component of the URI. More... | |
getQuery () | |
Retrieve the query string of the URI. More... | |
getFragment () | |
Retrieve the fragment component of the URI. More... | |
withScheme ($scheme) | |
Return an instance with the specified scheme. More... | |
withUserInfo ($user, $password=null) | |
Return an instance with the specified user information. More... | |
withHost ($host) | |
Return an instance with the specified host. More... | |
withPort ($port) | |
Return an instance with the specified port. More... | |
withPath ($path) | |
Return an instance with the specified path. More... | |
withQuery ($query) | |
Return an instance with the specified query string. More... | |
withFragment ($fragment) | |
Return an instance with the specified URI fragment. More... | |
Static Public Member Functions | |
static | composeComponents ($scheme, $authority, $path, $query, $fragment) |
Composes a URI reference string from its various components. More... | |
static | isDefaultPort (UriInterface $uri) |
Whether the URI has the default port of the current scheme. More... | |
static | isAbsolute (UriInterface $uri) |
Whether the URI is absolute, i.e. More... | |
static | isNetworkPathReference (UriInterface $uri) |
Whether the URI is a network-path reference. More... | |
static | isAbsolutePathReference (UriInterface $uri) |
Whether the URI is a absolute-path reference. More... | |
static | isRelativePathReference (UriInterface $uri) |
Whether the URI is a relative-path reference. More... | |
static | isSameDocumentReference (UriInterface $uri, UriInterface $base=null) |
Whether the URI is a same-document reference. More... | |
static | removeDotSegments ($path) |
Removes dot segments from a path and returns the new path. More... | |
static | resolve (UriInterface $base, $rel) |
Converts the relative URI into a new URI that is resolved against the base URI. More... | |
static | withoutQueryValue (UriInterface $uri, $key) |
Creates a new URI with a specific query string value removed. More... | |
static | withQueryValue (UriInterface $uri, $key, $value) |
Creates a new URI with a specific query string value. More... | |
static | fromParts (array $parts) |
Creates a URI from a hash of parse_url components. More... | |
Data Fields | |
const | HTTP_DEFAULT_HOST = 'localhost' |
Absolute http and https URIs require a host per RFC 7230 Section 2.7 but in generic URIs the host can be empty. More... | |
Private Member Functions | |
applyParts (array $parts) | |
Apply parse_url parts to a URI. More... | |
filterScheme ($scheme) | |
filterHost ($host) | |
filterPort ($port) | |
removeDefaultPort () | |
filterPath ($path) | |
Filters the path of a URI. More... | |
filterQueryAndFragment ($str) | |
Filters the query string or fragment of a URI. More... | |
rawurlencodeMatchZero (array $match) | |
validateState () | |
Private Attributes | |
$scheme = '' | |
$userInfo = '' | |
$host = '' | |
$port | |
$path = '' | |
$query = '' | |
$fragment = '' | |
Static Private Attributes | |
static | $defaultPorts |
static static | $charUnreserved = 'a-zA-Z0-9_\-\.~' |
static | $charSubDelims = '!\$&\'\(\)\*\+,;=' |
static | $replaceQuery = ['=' => '%3D' |
GuzzleHttp\Psr7\Uri::__construct | ( | $uri = '' | ) |
string | $uri | URI to parse |
Definition at line 65 of file Uri.php.
References GuzzleHttp\Psr7\Uri\applyParts().
GuzzleHttp\Psr7\Uri::__toString | ( | ) |
Return the string representation as a URI reference.
Depending on which components of the URI are present, the resulting string is either a full URI or relative reference according to RFC 3986, Section 4.1. The method concatenates the various components of the URI, using the appropriate delimiters:
Implements Psr\Http\Message\UriInterface.
Definition at line 77 of file Uri.php.
References GuzzleHttp\Psr7\Uri\getAuthority().
|
private |
Apply parse_url parts to a URI.
array | $parts | Array of parse_url parts to apply. |
Definition at line 540 of file Uri.php.
References GuzzleHttp\Psr7\Uri\filterHost(), GuzzleHttp\Psr7\Uri\filterPath(), GuzzleHttp\Psr7\Uri\filterPort(), GuzzleHttp\Psr7\Uri\filterQueryAndFragment(), GuzzleHttp\Psr7\Uri\filterScheme(), and GuzzleHttp\Psr7\Uri\removeDefaultPort().
Referenced by GuzzleHttp\Psr7\Uri\__construct().
|
static |
Composes a URI reference string from its various components.
Usually this method does not need to be called manually but instead is used indirectly via Psr\Http\Message\UriInterface::__toString
.
PSR-7 UriInterface treats an empty component the same as a missing component as getQuery(), getFragment() etc. always return a string. This explains the slight difference to RFC 3986 Section 5.3.
Another adjustment is that the authority separator is added even when the authority is missing/empty for the "file" scheme. This is because PHP stream functions like file_get_contents
only work with file:///myfile
but not with file:/myfile
although they are equivalent according to RFC 3986. But file:///
is the more common syntax for the file scheme anyway (Chrome for example redirects to that format).
string | $scheme | |
string | $authority | |
string | $path | |
string | $query | |
string | $fragment |
https://tools.ietf.org/html/rfc3986#section-5.3
Definition at line 114 of file Uri.php.
References $authority, GuzzleHttp\Psr7\Uri\$fragment, GuzzleHttp\Psr7\Uri\$path, GuzzleHttp\Psr7\Uri\$query, and GuzzleHttp\Psr7\Uri\$scheme.
Referenced by GuzzleHttp\Psr7\UriResolver\resolve().
|
private |
string | $host |
Definition at line 591 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$host.
Referenced by GuzzleHttp\Psr7\Uri\applyParts(), and GuzzleHttp\Psr7\Uri\withHost().
|
private |
Filters the path of a URI.
string | $path |
Definition at line 639 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$path.
Referenced by GuzzleHttp\Psr7\Uri\applyParts(), and GuzzleHttp\Psr7\Uri\withPath().
|
private |
int | null | $port |
Definition at line 607 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$port.
Referenced by GuzzleHttp\Psr7\Uri\applyParts(), and GuzzleHttp\Psr7\Uri\withPort().
|
private |
Filters the query string or fragment of a URI.
string | $str |
Definition at line 661 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\applyParts(), GuzzleHttp\Psr7\Uri\withFragment(), and GuzzleHttp\Psr7\Uri\withQuery().
|
private |
string | $scheme |
Definition at line 575 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$scheme.
Referenced by GuzzleHttp\Psr7\Uri\applyParts(), and GuzzleHttp\Psr7\Uri\withScheme().
|
static |
Creates a URI from a hash of parse_url
components.
array | $parts |
GuzzleHttp\Psr7\Uri::getAuthority | ( | ) |
Retrieve the authority component of the URI.
If no authority information is present, this method MUST return an empty string.
The authority syntax of the URI is:
[user-info@]host[:port]
If the port component is not set or is the standard port for the current scheme, it SHOULD NOT be included.
Implements Psr\Http\Message\UriInterface.
Definition at line 383 of file Uri.php.
References $authority, GuzzleHttp\Psr7\Uri\$host, and GuzzleHttp\Psr7\Uri\$port.
Referenced by GuzzleHttp\Psr7\Uri\__toString(), and GuzzleHttp\Psr7\Uri\validateState().
GuzzleHttp\Psr7\Uri::getFragment | ( | ) |
Retrieve the fragment component of the URI.
If no fragment is present, this method MUST return an empty string.
The leading "#" character is not part of the fragment and MUST NOT be added.
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.5.
Implements Psr\Http\Message\UriInterface.
Definition at line 422 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$fragment.
GuzzleHttp\Psr7\Uri::getHost | ( | ) |
Retrieve the host component of the URI.
If no host is present, this method MUST return an empty string.
The value returned MUST be normalized to lowercase, per RFC 3986 Section 3.2.2.
Implements Psr\Http\Message\UriInterface.
Definition at line 402 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$host.
GuzzleHttp\Psr7\Uri::getPath | ( | ) |
Retrieve the path component of the URI.
The path can either be empty or absolute (starting with a slash) or rootless (not starting with a slash). Implementations MUST support all three syntaxes.
Normally, the empty path "" and absolute path "/" are considered equal as defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically do this normalization because in contexts with a trimmed base path, e.g. the front controller, this difference becomes significant. It's the task of the user to handle both "" and "/".
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.3.
As an example, if the value should include a slash ("/") not intended as delimiter between path segments, that value MUST be passed in encoded form (e.g., "%2F") to the instance.
Implements Psr\Http\Message\UriInterface.
Definition at line 412 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$path.
GuzzleHttp\Psr7\Uri::getPort | ( | ) |
Retrieve the port component of the URI.
If a port is present, and it is non-standard for the current scheme, this method MUST return it as an integer. If the port is the standard port used with the current scheme, this method SHOULD return null.
If no port is present, and no scheme is present, this method MUST return a null value.
If no port is present, but a scheme is present, this method MAY return the standard port for that scheme, but SHOULD return null.
Implements Psr\Http\Message\UriInterface.
Definition at line 407 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$port.
GuzzleHttp\Psr7\Uri::getQuery | ( | ) |
Retrieve the query string of the URI.
If no query string is present, this method MUST return an empty string.
The leading "?" character is not part of the query and MUST NOT be added.
The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986, Sections 2 and 3.4.
As an example, if a value in a key/value pair of the query string should include an ampersand ("&") not intended as a delimiter between values, that value MUST be passed in encoded form (e.g., "%26") to the instance.
Implements Psr\Http\Message\UriInterface.
Definition at line 417 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$query.
GuzzleHttp\Psr7\Uri::getScheme | ( | ) |
Retrieve the scheme component of the URI.
If no scheme is present, this method MUST return an empty string.
The value returned MUST be normalized to lowercase, per RFC 3986 Section 3.1.
The trailing ":" character is not part of the scheme and MUST NOT be added.
Implements Psr\Http\Message\UriInterface.
Definition at line 378 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$scheme.
GuzzleHttp\Psr7\Uri::getUserInfo | ( | ) |
Retrieve the user information component of the URI.
If no user information is present, this method MUST return an empty string.
If a user is present in the URI, this will return that value; additionally, if the password is also present, it will be appended to the user value, with a colon (":") separating the values.
The trailing "@" character is not part of the user information and MUST NOT be added.
Implements Psr\Http\Message\UriInterface.
Definition at line 397 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$userInfo.
|
static |
Whether the URI is absolute, i.e.
it has a scheme.
An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, the base URI. Relative references can be divided into several forms:
UriInterface | $uri |
Definition at line 174 of file Uri.php.
References Psr\Http\Message\UriInterface\getScheme().
|
static |
Whether the URI is a absolute-path reference.
A relative reference that begins with a single slash character is termed an absolute-path reference.
UriInterface | $uri |
Definition at line 204 of file Uri.php.
References Psr\Http\Message\UriInterface\getAuthority(), Psr\Http\Message\UriInterface\getPath(), and Psr\Http\Message\UriInterface\getScheme().
|
static |
Whether the URI has the default port of the current scheme.
Psr\Http\Message\UriInterface::getPort
may return null or the standard port. This method can be used independently of the implementation.
UriInterface | $uri |
Definition at line 150 of file Uri.php.
References Psr\Http\Message\UriInterface\getPort(), and Psr\Http\Message\UriInterface\getScheme().
Referenced by GuzzleHttp\Psr7\UriNormalizer\normalize().
|
static |
Whether the URI is a network-path reference.
A relative reference that begins with two slash characters is termed an network-path reference.
UriInterface | $uri |
Definition at line 189 of file Uri.php.
References Psr\Http\Message\UriInterface\getAuthority(), and Psr\Http\Message\UriInterface\getScheme().
|
static |
Whether the URI is a relative-path reference.
A relative reference that does not begin with a slash character is termed a relative-path reference.
UriInterface | $uri |
Definition at line 222 of file Uri.php.
References Psr\Http\Message\UriInterface\getAuthority(), Psr\Http\Message\UriInterface\getPath(), and Psr\Http\Message\UriInterface\getScheme().
Referenced by GuzzleHttp\Psr7\UriNormalizer\normalize(), and GuzzleHttp\Psr7\UriResolver\relativize().
|
static |
Whether the URI is a same-document reference.
A same-document reference refers to a URI that is, aside from its fragment component, identical to the base URI. When no base URI is given, only an empty URI reference (apart from its fragment) is considered a same-document reference.
UriInterface | $uri | The URI to check |
UriInterface | null | $base | An optional base URI to compare against |
Definition at line 242 of file Uri.php.
References $base, Psr\Http\Message\UriInterface\getAuthority(), Psr\Http\Message\UriInterface\getPath(), Psr\Http\Message\UriInterface\getQuery(), Psr\Http\Message\UriInterface\getScheme(), and GuzzleHttp\Psr7\UriResolver\resolve().
|
private |
|
private |
Definition at line 623 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\applyParts().
|
static |
Removes dot segments from a path and returns the new path.
string | $path |
Definition at line 266 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$path, and GuzzleHttp\Psr7\UriResolver\removeDotSegments().
|
static |
Converts the relative URI into a new URI that is resolved against the base URI.
UriInterface | $base | Base URI |
string | UriInterface | $rel | Relative URI |
Definition at line 282 of file Uri.php.
References GuzzleHttp\Psr7\UriResolver\resolve().
|
private |
Definition at line 679 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$path, and GuzzleHttp\Psr7\Uri\getAuthority().
GuzzleHttp\Psr7\Uri::withFragment | ( | $fragment | ) |
Return an instance with the specified URI fragment.
This method MUST retain the state of the current instance, and return an instance that contains the specified URI fragment.
Users can provide both encoded and decoded fragment characters. Implementations ensure the correct encoding as outlined in getFragment().
An empty fragment value is equivalent to removing the fragment.
string | $fragment | The fragment to use with the new instance. |
Implements Psr\Http\Message\UriInterface.
Definition at line 521 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$fragment, $new, and GuzzleHttp\Psr7\Uri\filterQueryAndFragment().
GuzzleHttp\Psr7\Uri::withHost | ( | $host | ) |
Return an instance with the specified host.
This method MUST retain the state of the current instance, and return an instance that contains the specified host.
An empty host value is equivalent to removing the host.
string | $host | The hostname to use with the new instance. |
Implements Psr\Http\Message\UriInterface.
Definition at line 461 of file Uri.php.
References GuzzleHttp\Psr7\Uri\$host, $new, and GuzzleHttp\Psr7\Uri\filterHost().
|
static |
Creates a new URI with a specific query string value removed.
Any existing query string values that exactly match the provided key are removed.
UriInterface | $uri | URI to use as a base. |
string | $key | Query string key to remove. |
Definition at line 302 of file Uri.php.
References $current, $key, $result, Psr\Http\Message\UriInterface\getQuery(), and Psr\Http\Message\UriInterface\withQuery().
GuzzleHttp\Psr7\Uri::withPath | ( | $path | ) |
Return an instance with the specified path.
This method MUST retain the state of the current instance, and return an instance that contains the specified path.
The path can either be empty or absolute (starting with a slash) or rootless (not starting with a slash). Implementations MUST support all three syntaxes.
If the path is intended to be domain-relative rather than path relative then it must begin with a slash ("/"). Paths not starting with a slash ("/") are assumed to be relative to some base path known to the application or consumer.
Users can provide both encoded and decoded path characters. Implementations ensure the correct encoding as outlined in getPath().
string | $path | The path to use with the new instance. |
Implements Psr\Http\Message\UriInterface.
Definition at line 492 of file Uri.php.
References $new, GuzzleHttp\Psr7\Uri\$path, and GuzzleHttp\Psr7\Uri\filterPath().
GuzzleHttp\Psr7\Uri::withPort | ( | $port | ) |
Return an instance with the specified port.
This method MUST retain the state of the current instance, and return an instance that contains the specified port.
Implementations MUST raise an exception for ports outside the established TCP and UDP port ranges.
A null value provided for the port is equivalent to removing the port information.
null | int | $port | The port to use with the new instance; a null value removes the port information. |
Implements Psr\Http\Message\UriInterface.
Definition at line 476 of file Uri.php.
References $new, GuzzleHttp\Psr7\Uri\$port, and GuzzleHttp\Psr7\Uri\filterPort().
GuzzleHttp\Psr7\Uri::withQuery | ( | $query | ) |
Return an instance with the specified query string.
This method MUST retain the state of the current instance, and return an instance that contains the specified query string.
Users can provide both encoded and decoded query characters. Implementations ensure the correct encoding as outlined in getQuery().
An empty query string value is equivalent to removing the query string.
string | $query | The query string to use with the new instance. |
Implements Psr\Http\Message\UriInterface.
Definition at line 507 of file Uri.php.
References $new, GuzzleHttp\Psr7\Uri\$query, and GuzzleHttp\Psr7\Uri\filterQueryAndFragment().
|
static |
Creates a new URI with a specific query string value.
Any existing query string values that exactly match the provided key are removed and replaced with the given key value pair.
A value of null will set the query string key without a value, e.g. "key" instead of "key=value".
UriInterface | $uri | URI to use as a base. |
string | $key | Key to set. |
string | null | $value | Value to set |
Definition at line 332 of file Uri.php.
References $current, $key, $result, Psr\Http\Message\UriInterface\getQuery(), and Psr\Http\Message\UriInterface\withQuery().
GuzzleHttp\Psr7\Uri::withScheme | ( | $scheme | ) |
Return an instance with the specified scheme.
This method MUST retain the state of the current instance, and return an instance that contains the specified scheme.
Implementations MUST support the schemes "http" and "https" case insensitively, and MAY accommodate other schemes if required.
An empty scheme is equivalent to removing the scheme.
string | $scheme | The scheme to use with the new instance. |
Implements Psr\Http\Message\UriInterface.
Definition at line 427 of file Uri.php.
References $new, GuzzleHttp\Psr7\Uri\$scheme, and GuzzleHttp\Psr7\Uri\filterScheme().
GuzzleHttp\Psr7\Uri::withUserInfo | ( | $user, | |
$password = null |
|||
) |
Return an instance with the specified user information.
This method MUST retain the state of the current instance, and return an instance that contains the specified user information.
Password is optional, but the user information MUST include the user; an empty string for the user is equivalent to removing user information.
string | $user | The user name to use for authority. |
null | string | $password | The password associated with $user. |
Implements Psr\Http\Message\UriInterface.
Definition at line 443 of file Uri.php.
References $info, $new, and $password.
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
Definition at line 60 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\composeComponents(), GuzzleHttp\Psr7\Uri\getFragment(), and GuzzleHttp\Psr7\Uri\withFragment().
|
private |
Definition at line 48 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\filterHost(), GuzzleHttp\Psr7\Uri\getAuthority(), GuzzleHttp\Psr7\Uri\getHost(), and GuzzleHttp\Psr7\Uri\withHost().
|
private |
Definition at line 54 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\composeComponents(), GuzzleHttp\Psr7\Uri\filterPath(), GuzzleHttp\Psr7\Uri\getPath(), GuzzleHttp\Psr7\Uri\removeDotSegments(), GuzzleHttp\Psr7\Uri\validateState(), and GuzzleHttp\Psr7\Uri\withPath().
|
private |
Definition at line 51 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\filterPort(), GuzzleHttp\Psr7\Uri\getAuthority(), GuzzleHttp\Psr7\Uri\getPort(), and GuzzleHttp\Psr7\Uri\withPort().
|
private |
Definition at line 57 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\composeComponents(), GuzzleHttp\Psr7\Uri\getQuery(), and GuzzleHttp\Psr7\Uri\withQuery().
|
staticprivate |
|
private |
Definition at line 42 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\composeComponents(), GuzzleHttp\Psr7\Uri\filterScheme(), GuzzleHttp\Psr7\Uri\getScheme(), and GuzzleHttp\Psr7\Uri\withScheme().
|
private |
Definition at line 45 of file Uri.php.
Referenced by GuzzleHttp\Psr7\Uri\getUserInfo().
const GuzzleHttp\Psr7\Uri::HTTP_DEFAULT_HOST = 'localhost' |