You are here

public function Monitoring::collect in DRD Agent 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Agent/Remote/Monitoring.php \Drupal\drd_agent\Agent\Remote\Monitoring::collect()

Collect the security review results.

Return value

array List of all the security review results.

Overrides BaseInterface::collect

File

src/Agent/Remote/Monitoring.php, line 13

Class

Monitoring
Implements the Monitoring class.

Namespace

Drupal\drd_agent\Agent\Remote

Code

public function collect() : array {
  $review = [];
  if ($this->moduleHandler
    ->moduleExists('monitoring')) {

    /* @var \Drupal\monitoring\Result\SensorResultInterface $result */
    foreach (monitoring_sensor_run_multiple() as $result) {
      $review[$result
        ->getSensorId()] = $result
        ->toArray();
      $review[$result
        ->getSensorId()]['label'] = $result
        ->getSensorConfig()
        ->getLabel();
    }
  }
  return $review;
}