You are here

public function RestIncidentStorage::getIncidents in Radioactivity 8.3

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

Gets all incidents from the storage.

Return value

\Drupal\radioactivity\IncidentInterface[] Array of incident objects.

Overrides IncidentStorageInterface::getIncidents

1 call to RestIncidentStorage::getIncidents()
RestIncidentStorage::getIncidentsByType in src/RestIncidentStorage.php
Gets all incidents from the storage per entity type.

File

src/RestIncidentStorage.php, line 29

Class

RestIncidentStorage
Defines a REST incident storage.

Namespace

Drupal\radioactivity

Code

public function getIncidents() {
  $data = $this
    ->getIncidentsFromStorage();
  $result = [];
  foreach ($data as $rows) {
    foreach ($rows as $row) {
      $incident = Incident::createFromPostData($row);
      if ($incident
        ->isValid()) {
        $result[] = $incident;
      }
    }
  }
  return $result;
}