Parse/expand request parameters and create a fully qualified
request uri.
@static
@param string $servicePath
@param string $restPath
@param array $params
@return string $requestUrl
436382
public static function createRequestUri($servicePath, $restPath, $params)
  {
    $requestUrl = $servicePath . $restPath;
    $uriTemplateVars = array();
    $queryVars = array();
    foreach ($params as $paramName => $paramSpec) {
      if ($paramSpec['type'] == 'boolean') {
        $paramSpec['value'] = ($paramSpec['value']) ? 'true' : 'false';
      }
      if ($paramSpec['location'] == 'path') {
        $uriTemplateVars[$paramName] = $paramSpec['value'];
      } else if ($paramSpec['location'] == 'query') {
        if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
          foreach ($paramSpec['value'] as $value) {
            $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
          }
        } else {
          $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
        }
      }
    }

    if (count($uriTemplateVars)) {
      $uriTemplateParser = new URITemplate();
      $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
    }

    if (count($queryVars)) {
      $requestUrl .= '?' . implode($queryVars, '&');
    }

    return $requestUrl;
  }
950082
protected function createAbsoluteUrl(UriInterface $basePath, $targetPath)
    {
        $targetPath = strval($targetPath);
        if ($targetPath === '') {
            return $basePath->withPath('');
        } else {
            if ($this->isRelativeUri($targetPath)) {
                $parts = parse_url($targetPath);
                $path  = isset($parts['path']) ? ltrim($parts['path'], '/') : '';
                $query = isset($parts['query']) ? $parts['query'] : '';
                $hash  = isset($parts['fragment']) ? $parts['fragment'] : '';
                $targetPath = $basePath->withPath($path)->withQuery($query)->withFragment($hash);
            }
        }

        return $targetPath;
    }
559618
protected function post($path, array $parameters = [], $requestHeaders = [])
    {
        $path = $this->preparePath($path);

        $body = null;
        if (!empty($parameters)) {
            $body = $this->streamFactory->createStream(QueryStringBuilder::build($parameters));
            $requestHeaders['Content-Type'] = 'application/x-www-form-urlencoded';
        }

        try {
            $response = $this->client->getHttpClient()->post($path, $requestHeaders, $body);
        } catch (HttpException $e) {
            (new ApiExceptionHandler($e))->handle();
        }

        return ResponseFormatter::getContent($response);
    }
444718
public function getRequestedRoute($basepath)
    {
        if ($basepath == '/') {
            $url = strtolower($_SERVER['REQUEST_URI']);
        } else {
            $url = explode($basepath, strtolower($_SERVER['REQUEST_URI']))[1];
        }

        return $this->_router->getRoute($url);
    }
75610
protected function get($path, array $parameters = [], array $requestHeaders = [])
    {
        $path = $this->preparePath($path, $parameters);

        try {
            $response = $this->client->getHttpClient()->get($path, $requestHeaders);

            return ResponseFormatter::getContent($response);
        } catch (HttpException $e) {
            (new ApiExceptionHandler($e))->handle();
        }
    }
680819
protected function url($path, array $parameters = null)
    {
    	$query = [
            'client_id' => $this->client_key,
    	    'redirect_uri' => $this->redirect_uri,
    	    'response_type' => 'code'
    	];

        if ($parameters)
            $query = array_merge($query, $parameters);

        $query = http_build_query($query);

        return sprintf('%s%s?%s', self::API_HOST, $path, $query);
    }
1013737
public function make($path = null, $params = [], $secure = false)
    {
        $this->secure = $secure;
        $params_index = strpos($path, '?');
        $query        = $params_index === false ? '' : parse_url($path, PHP_URL_QUERY);
        $path         = $params_index === false ? $path : substr($path, 0, $params_index);
        $path_params  = [];
        if ($query) {
            parse_str($query, $path_params);
        }

        $this->params = array_merge($path_params, $params);

        if (substr($path, 0, 4) === 'http') {
            $this->url = $path;
        } else {
            $scheme    = $this->secure ? 'https' : request()->getScheme();
            $site_root = request()->getHost() ? $scheme . '://' . request()->getHost() . '/' : '/';
            $this->url = $site_root . ltrim($path, '/');
        }

        return $this;
    }
1244948
public static function run(array $params = [], ?string $basePath = null): void
    {
        $instance = static::instance();

        $instance->bootstrap($basePath);

        $instance->runConsole($params);
    }
456336
protected function _getUri($path = '', $params = array()) {
        $url = $path;
        $url .= '?' . http_build_query($params, NULL, '&');
        return $url;
    }
1080632
public Response put(String restPath, Object payload, Map<String, String> queryParams) {
		LOG.debug("PUT: {}", restPath);
		return call(HttpMethod.PUT, restPath, Response.class, payload, queryParams);
	}
723783
public function matchRequestPath($requestPath)
    {
        foreach ([$requestPath, urlencode($requestPath), urldecode($requestPath)] as $path) {
            foreach ([$this->catch_path, urlencode($this->catch_path), urldecode($this->catch_path)] as $catch) {
                if ($this->pathMatcher($path, $catch)) {
                    return true;
                }
            }
        }

        return false;
    }
1066400
private function postRequireData($requestPath, array $postData)
    {
        $responseData = $this->post($requestPath, $postData);

        return self::requireNotNull($responseData);
    }
1048813
private String buildUrl( String methodPath, CPath path )
    {
        StringBuilder sb = new StringBuilder();

        sb.append( END_POINT ).append( '/' ).append( methodPath );

        if ( path != null ) {
            sb.append( '/' ).append( scope ).append( path.getUrlEncoded() );
        }

        return sb.toString();
    }
1287196
static String normalizeServicePath(String servicePath) {
    Preconditions.checkNotNull(servicePath, "service path cannot be null");
    if (servicePath.length() == 1) {
      Preconditions.checkArgument(
          "/".equals(servicePath), "service path must equal \"/\" if it is of length 1.");
      servicePath = "";
    } else if (servicePath.length() > 0) {
      if (!servicePath.endsWith("/")) {
        servicePath += "/";
      }
      if (servicePath.startsWith("/")) {
        servicePath = servicePath.substring(1);
      }
    }
    return servicePath;
  }
974464
public function withBasePath($basePath)
    {
        if (!is_string($basePath)) {
            throw new InvalidArgumentException('Uri path must be a string');
        }
        if (!empty($basePath)) {
            $basePath = '/' . trim($basePath, '/');
        }
        $clone = clone $this;

        if ($basePath !== '/') {
            $clone->basePath = Validator::checkPath($basePath);
        }

        return $clone;
    }
1075343
protected function setResourceMembers($resourcePath = null)
    {
        // File services need the trailing slash '/' for designating folders vs files
        // It is removed by the parent method
        $isFolder = (empty($resourcePath) ? false : ('/' === substr($resourcePath, -1)));
        parent::setResourceMembers($resourcePath);

        if (!empty($resourcePath)) {
            if ($isFolder) {
                $this->folderPath = $resourcePath;
            } else {
                $this->folderPath = dirname($resourcePath) . '/';
                $this->filePath = $resourcePath;
            }
        }

        return $this;
    }
638114
private function _doCreate($subPath, $params)
    {
        $fullPath = $this->_config->merchantPath() . $subPath;
        $response = $this->_http->post($fullPath, $params);

        return $this->_verifyGatewayResponse($response);
    }