Interface for a Uniform Resource Identifier parser/generator compatible with RFC 3986.
More...
Interface for a Uniform Resource Identifier parser/generator compatible with RFC 3986.
Definition at line 28 of file URIInterface.php.
| Erebot\URIInterface::__toString |
( |
| ) |
|
Returns the current URI as a string, in its normalized form.
- Note
- This method is a shortcut for \Erebot\URI\toURI(false).
Implemented in Erebot\URI.
| Erebot\URIInterface::asParsedURL |
( |
|
$component = -1 | ) |
|
Returns information about the current URI, in the same format as parse_url().
- Parameters
-
| $component | (optional) A specific component to return. Read the documentation about parse_url() for more information. |
- Return values
-
| mixed | Either an array, a string, an integer or null, depending on $component and the actual contents of this URI. Read the documentation about parse_url() for more information. |
- Note
- The behaviour of this method matches that of parse_url() as defined in PHP 5.5.19+, PHP 5.6.3+ and PHP 7.0.0+. In particular, an empty username/password is returned as such, rather than as a null value.
Implemented in Erebot\URI.
| static Erebot\URIInterface::fromAbsPath |
( |
|
$abspath, |
|
|
|
$strict = true |
|
) |
| |
|
static |
Given an absolute path to some file or directory, returns an URL belonging to the "file" schema and pointing to that file/directory.
- Note
- On Windows, network shares can be referred to using the UNC or long UNC notation.
- Parameters
-
| string | $abspath | Absolute path to the file or directory to refer to. |
| bool | $strict | (optional) Whether strict parsing rules apply or not. Defaults to true. When set to false, '/' is treated as a path separator even on systems where it is not the native separator (eg. Windows). |
- Return values
-
| Erebot::URI | An URL poiting to the same file/directory and belonging to the "file" scheme. |
- Exceptions
-
| ::InvalidArgumentException | The given $abspath was invalid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getFragment |
( |
|
$raw = false | ) |
|
Returns the current URI's fragment.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| mixed | The current URI's fragment as a string, eventually normalized or null. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getHost |
( |
|
$raw = false | ) |
|
Returns the current URI's host.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| mixed | The current URI's host as a string, eventually normalized or null. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getPath |
( |
|
$raw = false | ) |
|
Returns the current URI's path.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| string | The current URI's path as a string, eventually normalized. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getPort |
( |
|
$raw = false | ) |
|
Returns the current URI's port.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| mixed | When normalization is in effect, the port for the current URI will be returned as an integer, or null. When normalization has been disabled, the port will be returned as a string or null. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getQuery |
( |
|
$raw = false | ) |
|
Returns the current URI's query.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| mixed | The current URI's query as a string, eventually normalized or null. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getScheme |
( |
|
$raw = false | ) |
|
Returns the current URI's scheme.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| string | The current URI's scheme as a string, eventually normalized. |
Implemented in Erebot\URI.
| Erebot\URIInterface::getUserInfo |
( |
|
$raw = false | ) |
|
Returns the current URI's user information.
- Parameters
-
| bool | $raw | (optional) Whether the value should be normalized prior to being returned (false) or not (true). The default is to apply normalization. |
- Return values
-
| mixed | The current URI's user information, eventually normalized or null. |
Implemented in Erebot\URI.
| Erebot\URIInterface::relative |
( |
|
$reference | ) |
|
Given a relative reference, returns a new absolute URI matching that reference.
- Parameters
-
| string | $reference | Some relative reference (can be an absolute or relative URI). The current absolute URI is used as the base to dereference it. |
- Return values
-
- Exceptions
-
| ::InvalidArgumentException | The given $reference is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::setFragment |
( |
|
$fragment | ) |
|
Sets the current URI's fragment.
- Parameters
-
| mixed | $fragment | New fragment for this URI (either a string or null). |
- Exceptions
-
| ::InvalidArgumentException | The given $fragment is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::setHost |
( |
|
$host | ) |
|
Sets the current URI's host.
- Parameters
-
| string | $host | New host for this URI (either a string or null). |
- Exceptions
-
| ::InvalidArgumentException | The given $host is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::setPath |
( |
|
$path | ) |
|
Sets the current URI's path.
- Parameters
-
| string | $path | New path for this URI. |
- Exceptions
-
| ::InvalidArgumentException | The given $path is not valid. |
- Note
- This is a very thin wrapper around the internal method ::Erebot::URI::_setPath().
Implemented in Erebot\URI.
| Erebot\URIInterface::setPort |
( |
|
$port | ) |
|
Sets the current URI's port.
- Parameters
-
| mixed | $port | New port for this URI (either a numeric string, an integer or null). |
- Exceptions
-
| ::InvalidArgumentException | The given $port is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::setQuery |
( |
|
$query | ) |
|
Sets the current URI's query.
- Parameters
-
| mixed | $query | New query for this URI (either a string or null). |
- Exceptions
-
| ::InvalidArgumentException | The given $query is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::setScheme |
( |
|
$scheme | ) |
|
Sets the current URI's scheme.
- Parameters
-
| string | $scheme | New scheme for this URI, as a string. |
- Exceptions
-
| ::InvalidArgumentException | The given $scheme is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::setUserInfo |
( |
|
$userinfo | ) |
|
Sets the current URI's user information.
- Parameters
-
| mixed | $userinfo | New user information for this URI (either a string or null). |
- Exceptions
-
| ::InvalidArgumentException | The given user information is not valid. |
Implemented in Erebot\URI.
| Erebot\URIInterface::toURI |
( |
|
$raw = false, |
|
|
|
$credentials = true |
|
) |
| |
Returns the current URI as a string.
- Parameters
-
| bool | $raw | (optional) Whether the raw contents of the components should be used (true) or a normalized alternative (false). The default is to apply normalization. |
| bool | $credentials | (optional) Whether the content of the "user information" component should be part of the returned string (true) or not (false). The default is for such credentials to appear in the result. |
- Return values
-
| string | The current URI as a string, eventually normalized. |
Implemented in Erebot\URI.
The documentation for this interface was generated from the following file: