src/Google/Service/Resource.php
public function createRequestUri($restPath, $params)
  {
    // Override the default servicePath address if the $restPath use a /
    if ('/' == substr($restPath, 0, 1)) {
      $requestUrl = substr($restPath, 1);
    } else {
      $requestUrl = $this->servicePath . $restPath;
    }

    // code for leading slash
    if ($this->rootUrl) {
      if ('/' !== substr($this->rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) {
        $requestUrl = '/' . $requestUrl;
      }
      $requestUrl = $this->rootUrl . $requestUrl;
    }
    $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 (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 Google_Utils_UriTemplate();
      $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
    }

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

    return $requestUrl;
  }
public function createRequestUri($restPath, $params)
  {
    // Override the default servicePath address if the $restPath use a /
    if ('/' == substr($restPath, 0, 1)) {
      $requestUrl = substr($restPath, 1);
    } else {
      $requestUrl = $this->servicePath . $restPath;
    }

    // code for leading slash
    if ($this->rootUrl) {
      if ('/' !== substr($this->rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) {
        $requestUrl = '/' . $requestUrl;
      }
      $requestUrl = $this->rootUrl . $requestUrl;
    }
    $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 (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 Google_Utils_UriTemplate();
      $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars);
    }

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

    return $requestUrl;
  }
Parse/expand request parameters and create a fully qualified
request uri.
@static
@param string $restPath
@param array $params
@return string $requestUrl