public function ServicesClientConnectionRestServerFormatter::format in Services Client 7.2
Same name and namespace in other branches
- 7 services_client_connection/plugins/ServicesClientConnectionRestServer.inc \ServicesClientConnectionRestServerFormatter::format()
Format data for remote site.
Parameters
array $data:
ServicesClientConnectionHttpRequest $request:
File
- services_client_connection/
plugins/ ServicesClientConnectionRestServer.inc, line 230
Class
Code
public function format(&$request) {
$request->data_raw = $request->data;
if ($request->http_method != 'GET') {
// Format data
if (!empty($request->data) && ($method = $this
->getFormatterInfo('method'))) {
$request->data = call_user_func_array(array(
$this,
$method,
), array(
$request->data,
$request,
));
}
elseif (empty($request->data)) {
$request->data = '';
}
}
// Add header Content-Type
if ($content_type = $this
->getFormatterInfo('content_type')) {
$request->http_headers['Content-Type'] = $content_type;
}
}