You are here

public function Uri::getAuthority in Lockr 7.3

Retrieve the authority component of the URI.

If no authority information is present, this method MUST return an empty string.

The authority syntax of the URI is:

<pre> [user-info@]host[:port] </pre>

If the port component is not set or is the standard port for the current scheme, it SHOULD NOT be included.

Return value

string The URI authority, in "[user-info@]host[:port]" format.

Overrides UriInterface::getAuthority

See also

https://tools.ietf.org/html/rfc3986#section-3.2

2 calls to Uri::getAuthority()
Uri::validateState in vendor/guzzlehttp/psr7/src/Uri.php
Uri::__toString in vendor/guzzlehttp/psr7/src/Uri.php
Return the string representation as a URI reference.

File

vendor/guzzlehttp/psr7/src/Uri.php, line 378

Class

Uri
PSR-7 URI implementation.

Namespace

GuzzleHttp\Psr7

Code

public function getAuthority() {
  $authority = $this->host;
  if ($this->userInfo !== '') {
    $authority = $this->userInfo . '@' . $authority;
  }
  if ($this->port !== null) {
    $authority .= ':' . $this->port;
  }
  return $authority;
}