public static function Incident::createFromPostData in Radioactivity 8.3
Same name and namespace in other branches
- 8.2 src/Incident.php \Drupal\radioactivity\Incident::createFromPostData()
- 4.0.x src/Incident.php \Drupal\radioactivity\Incident::createFromPostData()
Create an Incident from data received in an http request.
Parameters
array $data: Associative array of incident data.
Return value
\Drupal\radioactivity\IncidentInterface An Incident object.
3 calls to Incident::createFromPostData()
- EmitController::emit in src/
Controller/ EmitController.php - Callback for /radioactivity/emit.
- IncidentTest::testCreateFromPostData in tests/
src/ Unit/ IncidentTest.php - @covers ::createFromPostData
- RestIncidentStorage::getIncidents in src/
RestIncidentStorage.php - Gets all incidents from the storage.
File
- src/
Incident.php, line 117
Class
- Incident
- Data class for Radioactivity Incident.
Namespace
Drupal\radioactivityCode
public static function createFromPostData(array $data) {
$data += [
'fn' => '',
'et' => '',
'id' => '',
'e' => 0,
'h' => '',
];
return new Incident($data['fn'], $data['et'], $data['id'], $data['e'], $data['h']);
}