You are here

public function Uri::getPort in Zircon Profile 8

Same name in this branch
  1. 8 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\Uri::getPort()
  2. 8 vendor/guzzlehttp/psr7/src/Uri.php \GuzzleHttp\Psr7\Uri::getPort()
Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-diactoros/src/Uri.php \Zend\Diactoros\Uri::getPort()

Retrieve the port component of the URI.

If a port is present, and it is non-standard for the current scheme, this method MUST return it as an integer. If the port is the standard port used with the current scheme, this method SHOULD return null.

If no port is present, and no scheme is present, this method MUST return a null value.

If no port is present, but a scheme is present, this method MAY return the standard port for that scheme, but SHOULD return null.

Return value

null|int The URI port.

Overrides UriInterface::getPort

File

vendor/zendframework/zend-diactoros/src/Uri.php, line 187

Class

Uri
Implementation of Psr\Http\UriInterface.

Namespace

Zend\Diactoros

Code

public function getPort() {
  return $this
    ->isNonStandardPort($this->scheme, $this->host, $this->port) ? $this->port : null;
}