/** * Url encode parameter data and convert nested query strings into a flattened hash. * * @param array $data The data to encode * * @return array Returns an array of encoded values and keys */ protected function prepareData(array $data) { // If no aggregator is present then set the default if (!$this->aggregator) { $this->setAggregator(null); } $temp = array(); foreach ($data as $key => $value) { if (is_array($value)) { $temp = array_merge($temp, $this->aggregator->aggregate($key, $value, $this)); } else { $temp[$this->encodeValue($key)] = $this->encodeValue($value); } } return $temp; }
/** * Url encode parameter data and convert nested query strings into a flattened hash. * * @param array $data The data to encode * * @return array Returns an array of encoded values and keys */ protected function prepareData(array $data) { // If no aggregator is present then set the default if (!$this->aggregator) { $this->setAggregator(null); } $temp = array(); foreach ($data as $key => $value) { if ($value === false || $value === null) { // False and null will not include the "=". Use an empty string to include the "=". $temp[$this->encodeValue($key)] = $value; } elseif (is_array($value)) { $temp = array_merge($temp, $this->aggregator->aggregate($key, $value, $this)); } else { $temp[$this->encodeValue($key)] = $this->encodeValue($value); } } return $temp; }