private function RestProcessor::verifyData in Radioactivity 8.3
Same name and namespace in other branches
- 4.0.x src/RestProcessor.php \Drupal\radioactivity\RestProcessor::verifyData()
Simple verification of the incident data.
Parameters
string $data: Json encoded emission data received in $_POST.
Return value
bool True when $data is a valid object, false if not.
1 call to RestProcessor::verifyData()
- RestProcessor::processData in src/
RestProcessor.php - Processes incoming radioactivity incident data.
File
- src/
RestProcessor.php, line 117
Class
- RestProcessor
- The worker class for the Radioactivity rest endpoint.
Namespace
Drupal\radioactivityCode
private function verifyData($data) {
$incidents = json_decode($data, TRUE);
$keys = [
'fn',
'et',
'id',
'e',
'h',
];
foreach ($incidents as $incident) {
if (count($keys) !== count($incident) || count(array_intersect_key(array_flip($keys), $incident)) !== count($keys)) {
return FALSE;
}
}
return TRUE;
}