You are here

private function Uri::filterPort in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/src/Uri.php \GuzzleHttp\Psr7\Uri::filterPort()

Parameters

string $scheme:

string $host:

int $port:

Return value

int|null

Throws

\InvalidArgumentException If the port is invalid.

2 calls to Uri::filterPort()
Uri::applyParts in vendor/guzzlehttp/psr7/src/Uri.php
Apply parse_url parts to a URI.
Uri::withPort in vendor/guzzlehttp/psr7/src/Uri.php
Return an instance with the specified port.

File

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

Class

Uri
Basic PSR-7 URI implementation.

Namespace

GuzzleHttp\Psr7

Code

private function filterPort($scheme, $host, $port) {
  if (null !== $port) {
    $port = (int) $port;
    if (1 > $port || 0xffff < $port) {
      throw new \InvalidArgumentException(sprintf('Invalid port: %d. Must be between 1 and 65535', $port));
    }
  }
  return $this
    ->isNonStandardPort($scheme, $host, $port) ? $port : null;
}