function _restclient_map_variables in RESTClient 7.2
Map the variable values and defaults
Parameters
array $variables [reference]:
2 calls to _restclient_map_variables()
- _restclient_request in ./
restclient.module - Basic request with no body data.
- _restclient_request_with_body in ./
restclient.module - Requests with body data.
File
- ./
restclient.module, line 764 - Defines a standard REST interface to RESTful services
Code
function _restclient_map_variables(&$variables) {
// Map variables
// Endpoint
if (!empty($variables['endpoint'])) {
// Do nothing
}
else {
$variables['endpoint'] = variable_get('restclient_hostname', 'http://localhost:80/rest');
}
// Retry
if (isset($variables['retry']) && is_numeric($variables['retry']) && intval($variables['retry']) >= 0) {
// Do nothing
}
else {
$variables['retry'] = 3;
}
// Timeout
if (isset($variables['timeout']) && is_numeric($variables['timeout']) && intval($variables['timeout']) >= 0) {
// Do nothing
}
else {
$variables['timeout'] = 30;
}
// Cache reset
$variables['reset'] = isset($variables['reset']) ? $variables['reset'] : FALSE;
// Headers
if (isset($variables['headers']) and is_array($variables['headers'])) {
// Do nothing
}
else {
$variables['headers'] = array();
}
// Additional headers
$additional_headers = variable_get('restclient_additional_headers', FALSE);
if ($additional_headers and is_array($additional_headers)) {
$variables['headers'] = array_merge($additional_headers, $variables['headers']);
}
}