protected function QueryString::encodeData

Url encode parameter data.

If a parameter value is an array and no aggregator has been set, the values of the array will be converted into a PHP compatible form array. If an aggregator is set, the values will be converted using the aggregator function

Parameters

array $data The data to encode:

Return value

array Returns an array of encoded values and keys

2 calls to QueryString::encodeData()
QueryString::urlEncode in drupal/core/vendor/guzzle/http/Guzzle/Http/QueryString.php
Returns an array of url encoded field names and values
QueryString::__toString in drupal/core/vendor/guzzle/http/Guzzle/Http/QueryString.php
Convert the query string parameters to a query string string

File

drupal/core/vendor/guzzle/http/Guzzle/Http/QueryString.php, line 303

Class

QueryString
Query string object to handle managing query string parameters and aggregating those parameters together as a string.

Namespace

Guzzle\Http

Code

protected function encodeData(array $data) {
  $temp = array();
  foreach ($data as $key => $value) {
    if (is_array($value)) {
      $temp = array_merge($temp, call_user_func_array($this->aggregator, array(
        $key,
        $value,
        $this->urlEncode,
      )));
    }
    else {
      if ($this->urlEncode) {
        $temp[rawurlencode($key)] = rawurlencode($value);
      }
      else {
        $temp[$key] = (string) $value;
      }
    }
  }
  return $temp;
}