class WsDataNode in Web Service Data 7
Hierarchy
- class \WsData
- class \WsDataNode
Expanded class hierarchy of WsDataNode
1 string reference to 'WsDataNode'
- _wsfields_storage_test_field_definitions in modules/
wsfields_storage/ wsfields_storage.test - Test field definitions
File
- modules/
ws_services/ includes/ WsDataNode.inc, line 2
View source
class WsDataNode extends WsData {
// Returns an array of the content type of the data this processor accepts
public function accepts() {
return array(
'json',
);
}
// Parse the web service response string into a structured array and return the array
protected function parse($data) {
$data = $this
->unwrap(json_decode($data));
foreach ($data as $name => $value) {
if (is_array($value)) {
foreach ($data[$name] as $lang => $list) {
if (is_array($list)) {
foreach ($list as $id => $val) {
if (is_array($val) and isset($val['value'])) {
$data[$name][$lang][$id] = $val['value'];
}
}
}
}
}
}
return $data;
}
private function unwrap($data) {
if (is_object($data)) {
$data = get_object_vars($data);
}
if (is_array($data)) {
foreach ($data as $k => $v) {
$data[$k] = $this
->unwrap($v);
}
}
return $data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
WsData:: |
public | property | ||
WsData:: |
protected | property | ||
WsData:: |
protected | property | ||
WsData:: |
public | function | Add data to an empty object or replace all existing data | |
WsData:: |
public | function | Retrieve the value for the given data key. | 1 |
WsData:: |
public | function | ||
WsData:: |
public | function | ||
WsDataNode:: |
public | function |
Overrides WsData:: |
|
WsDataNode:: |
protected | function |
Overrides WsData:: |
|
WsDataNode:: |
private | function |