Set gateway url for different gateway modes

@param       string      $gatewayUrl         Gateway url
@param       string      $gatewayMode        Mode for gateway url: sandbox, production

@return      self
180210
public function setGatewayUrl($gatewayUrl, $gatewayMode)
    {
        $this->checkGatewayMode($gatewayMode);

        switch ($gatewayMode)
        {
            case self::GATEWAY_MODE_SANDBOX:
            {
                $this->setGatewayUrlSandbox($gatewayUrl);
                break;
            }
            case self::GATEWAY_MODE_PRODUCTION:
            {
                $this->setGatewayUrlProduction($gatewayUrl);
                break;
            }
        }

        return $this;
    }
715937
private function gateway($url)
	{
        if($this->method == 'POST') {
            $result = $this->createClient()->post($url);
        }
        else {
            $result = $this->createClient()->get($url);
        }

		if($result->getStatusCode() != 200) {
			throw new Exception(trans('location::errors.no_connect'));
		}

		$this->response = $result->getBody()->getContents();

		return $this->response;
	}
260820
def add_gateway_router(self, router, network):
        '''
        
        '''
        router_id = self._find_router_id(router)
        net_id = self._find_network_id(network)
        return self.network_conn.add_gateway_router(
            router=router_id, body={'network_id': net_id})
460740
def set_gateway(self, gateway):
        '''
        
        '''
        self.gateway = gateway
        self.gewest.gateway = gateway
1198528
function getGatewayUrl (config) {
  if (!config.Addresses) {
    return
  }

  if (!config.Addresses.Gateway) {
    return false
  }

  const addr = multiaddr(config.Addresses.Gateway)

  // We need an address of the format /ip4/127.0.0.1/tcp/8080
  const protos = addr.protoNames()
  if (protos[0] !== 'ip4' || protos[1] !== 'tcp') {
    return false
  }

  const {address, port} = addr.nodeAddress()
  return `http://${address}:${port}`
}
180982
public function withGuid(string $guid): self
    {
        $this->guid        = $guid;
        $this->isPermaLink = true;
        return $this;
    }
497685
public function setRedirectUrl($redirectUrl = '')
    {
        $this->redirectUrl = $redirectUrl;
        $this->debug->debug(__FUNCTION__, 'setRedirectUrl: ' . json_encode($this->redirectUrl));

        return $this;
    }
24375
public function setUrl(string $url): RequestContext
    {
        $this->assertValidUrl($url);

        $this->url = $url;

        return $this;
    }
275432
async def set_as_default_gateway(self):
        """"""
        interface = self._data['interface']
        await interface._handler.set_default_gateway(
            system_id=interface.node.system_id, id=interface.id,
            link_id=self.id)
1163499
private function setUrl(?string $url): self
    {
        $this->updatePropertyValue(
            UrlFieldInterface::PROP_URL,
            $url
        );

        return $this;
    }
188709
private function addUrl($url, $lastmod = null): self
    {
        if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
            $url = hu.ltrim($url, '/');
        }

        if (preg_match('/[\'"<>]/', $url)) {
            $url = htmlspecialchars($url, ENT_QUOTES);
        }

        if (isset($this->addUrlset[$url])) {
            return $this;
        }

        if ($lastmod !== null) {
            if (!is_int($lastmod)) {
                $lastmod = strtotime($lastmod);
            }

            if ($lastmod !== false) {
                $lastmod = safe_strftime('iso8601', $lastmod);
            }
        }

        $this->addUrlset[$url] =
            '<url>'.
                '<loc>'.$url.'</loc>'.
                ($lastmod ? '<lastmod>'.$lastmod.'</lastmod>' : '').
            '</url>';

        return $this;
    }
192336
public function setGatewayAuthMethod($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Iot\V1\GatewayAuthMethod::class);
        $this->gateway_auth_method = $var;

        return $this;
    }
348568
public function setBaseUrl($baseUrl)
    {
        if (substr($baseUrl, 0, 2) === '//') {
            $baseUrl = 'http:'.$baseUrl;
            $this->isRelativeDomain = true;
        }

        $this->baseUrl = rtrim($baseUrl, '/');
    }
894906
public function setRequestUrl($requestUrl)
    {
        if (!$this->getUrlValidator()->isValid($requestUrl)) {
            throw new InvalidArgumentException('URL provided is invalid');
        }

        $this->requestUrl = $requestUrl;
    }
1220701
function useGatewayAuthentication(req) {
  // can be set on request if via application supplied callback
  if (req.useGateway == true) { return true; }

  // otherwise via query parameter
  var origUrl = req.originalUrl;
  var useGateway = false;
  var idx = origUrl.indexOf(gatewayParameter);
  if (idx >= 0) {
    useGateway = true;
  }

  return useGateway;
}
756301
public function setUrl(string $url) : Request
    {
        $components = parse_url($url);

        if ($components === false) {
            throw new \InvalidArgumentException('The URL provided is not valid.');
        }

        if (! isset($components['scheme'])) {
            throw new \InvalidArgumentException('The URL must have a scheme.');
        }

        $scheme = strtolower($components['scheme']);

        if ($scheme !== 'http' && $scheme !== 'https') {
            throw new \InvalidArgumentException(sprintf('The URL scheme "%s" is not acceptable.', $scheme));
        }

        $isSecure = ($scheme === 'https');

        if (! isset($components['host'])) {
            throw new \InvalidArgumentException('The URL must have a host name.');
        }

        $host = $components['host'];

        if (isset($components['port'])) {
            $port = $components['port'];
            $hostHeader = $host . ':' . $port;
        } else {
            $port = ($isSecure ? 443 : 80);
            $hostHeader = $host;
        }

        $this->path = isset($components['path']) ? $components['path'] : '/';
        $requestUri = $this->path;

        if (isset($components['query'])) {
            $this->queryString = $components['query'];
            parse_str($this->queryString, $this->query);
            $requestUri .= '?' . $this->queryString;
        } else {
            $this->queryString = '';
            $this->query = [];
        }

        $this->setHeader('Host', $hostHeader);

        $this->host = $host;
        $this->port = $port;
        $this->isSecure = $isSecure;
        $this->requestUri = $requestUri;

        return $this;
    }
409284
public function externalUrl($url)
    {
        $this->link_type = self::LINK_EXTERNAL_URL;
        $this->link_value = [$url];
        $this->setOpenNewWindowOption();
        $this->setActive(false);

        return $this;
    }