You are here

public function DefaultIncidentStorage::addIncident in Radioactivity 8.3

Same name and namespace in other branches
  1. 4.0.x src/DefaultIncidentStorage.php \Drupal\radioactivity\DefaultIncidentStorage::addIncident()

Adds an incident to the storage.

Parameters

\Drupal\radioactivity\IncidentInterface $incident: The incident object.

Overrides IncidentStorageInterface::addIncident

File

src/DefaultIncidentStorage.php, line 32

Class

DefaultIncidentStorage
Defines a default incident storage.

Namespace

Drupal\radioactivity

Code

public function addIncident(IncidentInterface $incident) {
  $incidents = $this->state
    ->get(self::STORAGE_KEY, []);
  $incidents[] = $incident;
  $this->state
    ->set(self::STORAGE_KEY, $incidents);
}