Erebot  latest
A modular IRC bot for PHP 5.3+
Erebot\URIInterface Interface Reference

Interface for a Uniform Resource Identifier parser/generator compatible with RFC 3986. More...

+ Inheritance diagram for Erebot\URIInterface:

Public Member Functions

 __toString ()
 
 asParsedURL ($component=-1)
 
 getFragment ($raw=false)
 
 getHost ($raw=false)
 
 getPath ($raw=false)
 
 getPort ($raw=false)
 
 getQuery ($raw=false)
 
 getScheme ($raw=false)
 
 getUserInfo ($raw=false)
 
 relative ($reference)
 
 setFragment ($fragment)
 
 setHost ($host)
 
 setPath ($path)
 
 setPort ($port)
 
 setQuery ($query)
 
 setScheme ($scheme)
 
 setUserInfo ($userinfo)
 
 toURI ($raw=false, $credentials=true)
 

Static Public Member Functions

static fromAbsPath ($abspath, $strict=true)
 

Detailed Description

Interface for a Uniform Resource Identifier parser/generator compatible with RFC 3986.

Definition at line 28 of file URIInterface.php.

Member Function Documentation

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
mixedEither 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$abspathAbsolute 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::URIAn URL poiting to the same file/directory and belonging to the "file" scheme.
Exceptions
::InvalidArgumentExceptionThe 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
mixedThe 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
mixedThe 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
stringThe 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
mixedWhen 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
mixedThe 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
stringThe 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
mixedThe 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$referenceSome relative reference (can be an absolute or relative URI). The current absolute URI is used as the base to dereference it.
Return values
Erebot::URIA new absolute URI matching the given $reference.
Exceptions
::InvalidArgumentExceptionThe given $reference is not valid.

Implemented in Erebot\URI.

Erebot\URIInterface::setFragment (   $fragment)

Sets the current URI's fragment.

Parameters
mixed$fragmentNew fragment for this URI (either a string or null).
Exceptions
::InvalidArgumentExceptionThe given $fragment is not valid.

Implemented in Erebot\URI.

Erebot\URIInterface::setHost (   $host)

Sets the current URI's host.

Parameters
string$hostNew host for this URI (either a string or null).
Exceptions
::InvalidArgumentExceptionThe given $host is not valid.

Implemented in Erebot\URI.

Erebot\URIInterface::setPath (   $path)

Sets the current URI's path.

Parameters
string$pathNew path for this URI.
Exceptions
::InvalidArgumentExceptionThe 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$portNew port for this URI (either a numeric string, an integer or null).
Exceptions
::InvalidArgumentExceptionThe given $port is not valid.

Implemented in Erebot\URI.

Erebot\URIInterface::setQuery (   $query)

Sets the current URI's query.

Parameters
mixed$queryNew query for this URI (either a string or null).
Exceptions
::InvalidArgumentExceptionThe given $query is not valid.

Implemented in Erebot\URI.

Erebot\URIInterface::setScheme (   $scheme)

Sets the current URI's scheme.

Parameters
string$schemeNew scheme for this URI, as a string.
Exceptions
::InvalidArgumentExceptionThe given $scheme is not valid.

Implemented in Erebot\URI.

Erebot\URIInterface::setUserInfo (   $userinfo)

Sets the current URI's user information.

Parameters
mixed$userinfoNew user information for this URI (either a string or null).
Exceptions
::InvalidArgumentExceptionThe 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
stringThe current URI as a string, eventually normalized.

Implemented in Erebot\URI.


The documentation for this interface was generated from the following file: