public function setPort($port = null)
    {
        if (is_null($port) || is_int($port)) {
            $this->port = $port;
        }
        else if (is_string($port) && preg_match('/^[0-9]+$/', $port) !== 0) {
            $this->port = (int) $port;
        }
        else {
            throw new \InvalidArgumentException(
                "invalid value provided for 'port'; ".
                "expecting an integer, string of integers, or null"
            );
        }
        return $this;
    }
public function setPort($port = null)
    {
        if (is_null($port) || is_int($port)) {
            $this->port = $port;
        }
        else if (is_string($port) && preg_match('/^[0-9]+$/', $port) !== 0) {
            $this->port = (int) $port;
        }
        else {
            throw new \InvalidArgumentException(
                "invalid value provided for 'port'; ".
                "expecting an integer, string of integers, or null"
            );
        }
        return $this;
    }
public function setPort ( $ port = null ) { if ( is_null ( $ port ) || is_int ( $ port ) ) { $ this -> port = $ port ; } else if ( is_string ( $ port ) && preg_match ( '/^[0-9]+$/' , $ port ) !== 0 ) { $ this -> port = ( int ) $ port ; } else { throw new \ InvalidArgumentException ( "invalid value provided for 'port'; " . "expecting an integer, string of integers, or null" ) ; } return $ this ; }
Set the port portion of the url

@param string|null $port
Set the port portion of the url