public function Uri::__toString in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\Uri::__toString()
- 8 vendor/guzzlehttp/psr7/src/Uri.php \GuzzleHttp\Psr7\Uri::__toString()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\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:
- 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
Overrides UriInterface::__toString
See also
http://tools.ietf.org/html/rfc3986#section-4.1
File
- vendor/
zendframework/ zend-diactoros/ src/ Uri.php, line 122
Class
- Uri
- Implementation of Psr\Http\UriInterface.
Namespace
Zend\DiactorosCode
public function __toString() {
if (null !== $this->uriString) {
return $this->uriString;
}
$this->uriString = static::createUriString($this->scheme, $this
->getAuthority(), $this
->getPath(), $this->query, $this->fragment);
return $this->uriString;
}