Chris@0: Chris@0: * [user-info@]host[:port] Chris@0: * Chris@0: * Chris@0: * If the port component is not set or is the standard port for the current Chris@0: * scheme, it SHOULD NOT be included. Chris@0: * Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-3.2 Chris@0: * @return string The URI authority, in "[user-info@]host[:port]" format. Chris@0: */ Chris@0: public function getAuthority(); Chris@0: Chris@0: /** Chris@0: * Retrieve the user information component of the URI. Chris@0: * Chris@0: * If no user information is present, this method MUST return an empty Chris@0: * string. Chris@0: * Chris@0: * If a user is present in the URI, this will return that value; Chris@0: * additionally, if the password is also present, it will be appended to the Chris@0: * user value, with a colon (":") separating the values. Chris@0: * Chris@0: * The trailing "@" character is not part of the user information and MUST Chris@0: * NOT be added. Chris@0: * Chris@0: * @return string The URI user information, in "username[:password]" format. Chris@0: */ Chris@0: public function getUserInfo(); Chris@0: Chris@0: /** Chris@0: * Retrieve the host component of the URI. Chris@0: * Chris@0: * If no host is present, this method MUST return an empty string. Chris@0: * Chris@0: * The value returned MUST be normalized to lowercase, per RFC 3986 Chris@0: * Section 3.2.2. Chris@0: * Chris@0: * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 Chris@0: * @return string The URI host. Chris@0: */ Chris@0: public function getHost(); Chris@0: Chris@0: /** Chris@0: * Retrieve the port component of the URI. Chris@0: * Chris@0: * If a port is present, and it is non-standard for the current scheme, Chris@0: * this method MUST return it as an integer. If the port is the standard port Chris@0: * used with the current scheme, this method SHOULD return null. Chris@0: * Chris@0: * If no port is present, and no scheme is present, this method MUST return Chris@0: * a null value. Chris@0: * Chris@0: * If no port is present, but a scheme is present, this method MAY return Chris@0: * the standard port for that scheme, but SHOULD return null. Chris@0: * Chris@0: * @return null|int The URI port. Chris@0: */ Chris@0: public function getPort(); Chris@0: Chris@0: /** Chris@0: * Retrieve the path component of the URI. Chris@0: * Chris@0: * The path can either be empty or absolute (starting with a slash) or Chris@0: * rootless (not starting with a slash). Implementations MUST support all Chris@0: * three syntaxes. Chris@0: * Chris@0: * Normally, the empty path "" and absolute path "/" are considered equal as Chris@0: * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically Chris@0: * do this normalization because in contexts with a trimmed base path, e.g. Chris@0: * the front controller, this difference becomes significant. It's the task Chris@0: * of the user to handle both "" and "/". Chris@0: * Chris@0: * The value returned MUST be percent-encoded, but MUST NOT double-encode Chris@0: * any characters. To determine what characters to encode, please refer to Chris@0: * RFC 3986, Sections 2 and 3.3. Chris@0: * Chris@0: * As an example, if the value should include a slash ("/") not intended as Chris@0: * delimiter between path segments, that value MUST be passed in encoded Chris@0: * form (e.g., "%2F") to the instance. Chris@0: * Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-2 Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-3.3 Chris@0: * @return string The URI path. Chris@0: */ Chris@0: public function getPath(); Chris@0: Chris@0: /** Chris@0: * Retrieve the query string of the URI. Chris@0: * Chris@0: * If no query string is present, this method MUST return an empty string. Chris@0: * Chris@0: * The leading "?" character is not part of the query and MUST NOT be Chris@0: * added. Chris@0: * Chris@0: * The value returned MUST be percent-encoded, but MUST NOT double-encode Chris@0: * any characters. To determine what characters to encode, please refer to Chris@0: * RFC 3986, Sections 2 and 3.4. Chris@0: * Chris@0: * As an example, if a value in a key/value pair of the query string should Chris@0: * include an ampersand ("&") not intended as a delimiter between values, Chris@0: * that value MUST be passed in encoded form (e.g., "%26") to the instance. Chris@0: * Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-2 Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-3.4 Chris@0: * @return string The URI query string. Chris@0: */ Chris@0: public function getQuery(); Chris@0: Chris@0: /** Chris@0: * Retrieve the fragment component of the URI. Chris@0: * Chris@0: * If no fragment is present, this method MUST return an empty string. Chris@0: * Chris@0: * The leading "#" character is not part of the fragment and MUST NOT be Chris@0: * added. Chris@0: * Chris@0: * The value returned MUST be percent-encoded, but MUST NOT double-encode Chris@0: * any characters. To determine what characters to encode, please refer to Chris@0: * RFC 3986, Sections 2 and 3.5. Chris@0: * Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-2 Chris@0: * @see https://tools.ietf.org/html/rfc3986#section-3.5 Chris@0: * @return string The URI fragment. Chris@0: */ Chris@0: public function getFragment(); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified scheme. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified scheme. Chris@0: * Chris@0: * Implementations MUST support the schemes "http" and "https" case Chris@0: * insensitively, and MAY accommodate other schemes if required. Chris@0: * Chris@0: * An empty scheme is equivalent to removing the scheme. Chris@0: * Chris@0: * @param string $scheme The scheme to use with the new instance. Chris@0: * @return static A new instance with the specified scheme. Chris@0: * @throws \InvalidArgumentException for invalid or unsupported schemes. Chris@0: */ Chris@0: public function withScheme($scheme); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified user information. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified user information. Chris@0: * Chris@0: * Password is optional, but the user information MUST include the Chris@0: * user; an empty string for the user is equivalent to removing user Chris@0: * information. Chris@0: * Chris@0: * @param string $user The user name to use for authority. Chris@0: * @param null|string $password The password associated with $user. Chris@0: * @return static A new instance with the specified user information. Chris@0: */ Chris@0: public function withUserInfo($user, $password = null); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified host. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified host. Chris@0: * Chris@0: * An empty host value is equivalent to removing the host. Chris@0: * Chris@0: * @param string $host The hostname to use with the new instance. Chris@0: * @return static A new instance with the specified host. Chris@0: * @throws \InvalidArgumentException for invalid hostnames. Chris@0: */ Chris@0: public function withHost($host); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified port. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified port. Chris@0: * Chris@0: * Implementations MUST raise an exception for ports outside the Chris@0: * established TCP and UDP port ranges. Chris@0: * Chris@0: * A null value provided for the port is equivalent to removing the port Chris@0: * information. Chris@0: * Chris@0: * @param null|int $port The port to use with the new instance; a null value Chris@0: * removes the port information. Chris@0: * @return static A new instance with the specified port. Chris@0: * @throws \InvalidArgumentException for invalid ports. Chris@0: */ Chris@0: public function withPort($port); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified path. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified path. Chris@0: * Chris@0: * The path can either be empty or absolute (starting with a slash) or Chris@0: * rootless (not starting with a slash). Implementations MUST support all Chris@0: * three syntaxes. Chris@0: * Chris@0: * If the path is intended to be domain-relative rather than path relative then Chris@0: * it must begin with a slash ("/"). Paths not starting with a slash ("/") Chris@0: * are assumed to be relative to some base path known to the application or Chris@0: * consumer. Chris@0: * Chris@0: * Users can provide both encoded and decoded path characters. Chris@0: * Implementations ensure the correct encoding as outlined in getPath(). Chris@0: * Chris@0: * @param string $path The path to use with the new instance. Chris@0: * @return static A new instance with the specified path. Chris@0: * @throws \InvalidArgumentException for invalid paths. Chris@0: */ Chris@0: public function withPath($path); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified query string. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified query string. Chris@0: * Chris@0: * Users can provide both encoded and decoded query characters. Chris@0: * Implementations ensure the correct encoding as outlined in getQuery(). Chris@0: * Chris@0: * An empty query string value is equivalent to removing the query string. Chris@0: * Chris@0: * @param string $query The query string to use with the new instance. Chris@0: * @return static A new instance with the specified query string. Chris@0: * @throws \InvalidArgumentException for invalid query strings. Chris@0: */ Chris@0: public function withQuery($query); Chris@0: Chris@0: /** Chris@0: * Return an instance with the specified URI fragment. Chris@0: * Chris@0: * This method MUST retain the state of the current instance, and return Chris@0: * an instance that contains the specified URI fragment. Chris@0: * Chris@0: * Users can provide both encoded and decoded fragment characters. Chris@0: * Implementations ensure the correct encoding as outlined in getFragment(). Chris@0: * Chris@0: * An empty fragment value is equivalent to removing the fragment. Chris@0: * Chris@0: * @param string $fragment The fragment to use with the new instance. Chris@0: * @return static A new instance with the specified fragment. Chris@0: */ Chris@0: public function withFragment($fragment); Chris@0: Chris@0: /** Chris@0: * Return the string representation as a URI reference. Chris@0: * Chris@0: * Depending on which components of the URI are present, the resulting Chris@0: * string is either a full URI or relative reference according to RFC 3986, Chris@0: * Section 4.1. The method concatenates the various components of the URI, Chris@0: * using the appropriate delimiters: Chris@0: * Chris@0: * - If a scheme is present, it MUST be suffixed by ":". Chris@0: * - If an authority is present, it MUST be prefixed by "//". Chris@0: * - The path can be concatenated without delimiters. But there are two Chris@0: * cases where the path has to be adjusted to make the URI reference Chris@0: * valid as PHP does not allow to throw an exception in __toString(): Chris@0: * - If the path is rootless and an authority is present, the path MUST Chris@0: * be prefixed by "/". Chris@0: * - If the path is starting with more than one "/" and no authority is Chris@0: * present, the starting slashes MUST be reduced to one. Chris@0: * - If a query is present, it MUST be prefixed by "?". Chris@0: * - If a fragment is present, it MUST be prefixed by "#". Chris@0: * Chris@0: * @see http://tools.ietf.org/html/rfc3986#section-4.1 Chris@0: * @return string Chris@0: */ Chris@0: public function __toString(); Chris@0: }