You are here

public function UriInterface::__toString in Lockr 7.3

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:

  • If a scheme is present, it MUST be suffixed by ":".
  • If an authority is present, it MUST be prefixed by "//".
  • The path can be concatenated without delimiters. But there are two cases where the path has to be adjusted to make the URI reference valid as PHP does not allow to throw an exception in __toString():

    • If the path is rootless and an authority is present, the path MUST be prefixed by "/".
    • If the path is starting with more than one "/" and no authority is present, the starting slashes MUST be reduced to one.
  • If a query is present, it MUST be prefixed by "?".
  • If a fragment is present, it MUST be prefixed by "#".

Return value

string

See also

http://tools.ietf.org/html/rfc3986#section-4.1

1 method overrides UriInterface::__toString()
Uri::__toString in vendor/guzzlehttp/psr7/src/Uri.php
Return the string representation as a URI reference.

File

vendor/psr/http-message/src/UriInterface.php, line 322

Class

UriInterface
Value object representing a URI.

Namespace

Psr\Http\Message

Code

public function __toString();