public function HttpClientBaseFormatter::serialize in Http Client 7.2
Same name and namespace in other branches
- 6.2 includes/HttpClient.inc \HttpClientBaseFormatter::serialize()
Serializes arbitrary data.
Parameters
mixed $data: The data that should be serialized.
Return value
string The serialized data as a string.
Overrides HttpClientFormatter::serialize
File
- includes/
HttpClient.inc, line 340
Class
- HttpClientBaseFormatter
- A base formatter to format php and json.
Code
public function serialize($data) {
switch ($this->format) {
case self::FORMAT_PHP:
return serialize($data);
break;
case self::FORMAT_JSON:
return drupal_json_encode($data);
break;
case self::FORMAT_FORM:
return http_build_query($data, NULL, '&');
break;
}
}