code: protected function encodeParameters($parameters, $keyPrefix = null)
      {
          if (!is_array($parameters) && !is_object($parameters)) {
              return rawurlencode($parameters);
          }
  
          $encodedData = [];
  
          foreach ($parameters as $key => $value) {
              $encodedKey = is_null($keyPrefix) ? rawurlencode($key) : $keyPrefix.'['.rawurlencode($key).']';
  
              if (is_array($value) || is_object($value)) {
                  $encodedData[] = $this->encodeParameters($value, $encodedKey);
              } else {
                  $encodedData[] = $encodedKey.'='.rawurlencode($value);
              }
          }
  
          return implode('&', $encodedData);
      }
docs: Encode the given parameters into a url encoded string based upon RFC 3986.
  
  @param mixed       $parameters Parameters to encode
  @param string|null $keyPrefix  Key prefix
  
  @return string