Returns the port to use for insecure requests.
Defaults to 80, or the port specified by the server if the current
request is insecure.
@return int port number for insecure requests.
@see setPort()
481190
public function getPort()
    {
        if ($this->_port === null) {
            $this->_port = !$this->getIsSecureConnection() && isset($this->swooleRequest->server['SERVER_PORT']) ? (int) $this->swooleRequest->server['SERVER_PORT'] : 80;
        }

        return $this->_port;
    }
219531
protected function getDefaultPort()
    {
	    $driver = $this->mysql->driver;
	    $key    = $driver . '.default_port';
	    $port   = ini_get($key);

	    if ($port) {
	    	return $port;
	    }

	    return ini_get('mysqli.default_port');
    }
270617
public function getPort() : int
   {

      if ( null !== $this->port )
      {
         return $this->port;
      }

      if ( null === $this->scheme )
      {
         $this->scheme = static::$fallbackScheme;
      }

      switch ( \strtolower( $this->scheme ) )
      {
         case UrlScheme::HTTP : return 80;
         case UrlScheme::SSL  : return 443;
         case UrlScheme::FTP  : return 21;
         default              : return 0;
      }

   }
481765
private int getPort(URI endpoint) {
        if (endpoint.getPort() != -1) {
            return endpoint.getPort();
        } else if ("https".equals(endpoint.getScheme())) {
            return 443;
        } else {
            return 80;
        }
    }
1312869
public function getPort()
    {
        $defaultPorts = array(
            'mysql' => '3306',
            'pgsql' => '5432',
            'oci' => '1521',
        );
        if (!$this->rawConfig['port'] && isset($defaultPorts[$this->getType()])) {
            $this->rawConfig['port'] = $defaultPorts[$this->getType()];
        }

        return intval($this->rawConfig['port']);
    }
897026
public function getPort()
    {
        if ($this->isSlave() && ! $this->port) {
            return $this->_master->getPort();
        }
        return $this->port;
    }
803225
protected function findAvailablePort(int $port): ?int
	{
		$attempts = 0;

		while($attempts++ < static::MAX_PORTS_TO_TRY)
		{
			if(($socket = @fsockopen('localhost', $port, $errorNumber, $errorString, 0.1)) === false)
			{
				return $port;
			}

			fclose($socket);

			$port++;
		}

		return null;
	}
213805
public function getDefaultPort()
    {
        if (!$this->hasDefaultPort()) throw new UrlException(sprintf(
            "No default port for URL '%s'",
            $this->_inputString
        ));

        $scheme = $this->getScheme();
        if ($scheme == 'http') return 80;
        elseif ($scheme == 'https') return 443;
        else throw new UrlException("No default port for scheme '$scheme'");
    }
103696
protected function port(InputInterface $input) {
        $name = $input->getArgument('port');
        return isset($name) ? (int) $name : 8080;
    }
422079
public function setPort($port)
    {
        if ( ! is_null($port)) $port = (int) $port;

        $this->setAttribute('port', $port);

        return $this;
    }
87751
public function scanPortRange() {
        if (strtolower($this->typePort) == 'tcp') {
            $hostIp = $this->hostIP;
        } else if (strtolower($this->typePort) == 'udp') {
            $hostIp = "udp://$this->hostIP";
        } else {
            throw new \Exception('Port Type undefined!');
        }

        $errno = $errstr = null;
        for ($portNumber = $this->startPort; $portNumber <= $this->endPort; $portNumber++) {
            $handle = @fsockopen($hostIp, $portNumber, $errno, $errstr, $this->timeout);
            if ($handle) {
                $service = $this->getService($portNumber, strtolower($this->typePort));
                $this->openPorts[$portNumber] = (!empty($service)) ? $service : null;
                fclose($handle);
            }
        }
        return $this->openPorts;
    }
640026
public function getPort()
    {
        if (empty($this->port)) {
            if (array_key_exists($this->scheme, static::$defaultPorts)) {
                return static::$defaultPorts[$this->scheme];
            }
        }

        return $this->port;
    }
502249
public int getServerPort() {
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        // 321485
        int port = this._request.getServerPort();
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"getServerPort", "this->"+this+": "+" port --> " + String.valueOf(port));
        }
        return port;
    }
1229915
public function getPort() : string
  {
      // Check for proxy first
      $port = self::server('HTTP_X_FORWARDED_PORT');
      if ($port) {
          return (string)$port;
      }

      $protocol = (string)self::server('HTTP_X_FORWARDED_PROTO');
      if ($protocol === 'https') {
          return '443';
      }

      return (string)self::server('SERVER_PORT');
  }
125673
public int getPort()
    {
        if (port != 0) {
            return port;
        }
        else {
            final Connector connector = connectorHolder.get();
            if (connector != null) {
                Preconditions.checkState(connector.getLocalPort() > 0, "no port was set and the connector is not yet started!");
                return connector.getLocalPort();
            }
            else {
                return 0;
            }
        }
    }
290939
public function getPort()
    {
        if (null !== $this->port) {
            return $this->port;
        }

        $tmp = parse_url($this->getUrl());
        if (isset($tmp['port'])) {
            $this->setPort($tmp['port']);
        } elseif (isset($tmp['scheme'])) {
            $this->setPort(self::$defaultPorts[$tmp['scheme']]);
        }

        return $this->port;
    }
629021
public static function filterPort(?int $port, string $scheme = ''): ?int
    {
        if (null === $port) {
            return null;
        }

        $port = (int) $port;

        if (self::MIN_PORT > $port || self::MAX_PORT < $port) {
            throw new \InvalidArgumentException(
                sprintf('Invalid port: %d. Must be between %d and %d', $port, self::MIN_PORT, self::MAX_PORT)
            );
        }

        if (DefaultPortIdentifier::isDefaultPort($scheme, $port)) {
            $port = null;
        }

        return $port;
    }