You are here

protected function SensorRunner::getResultObject in Monitoring 7

Same name and namespace in other branches
  1. 8 src/SensorRunner.php \Drupal\monitoring\SensorRunner::getResultObject()

Instantiates sensor result object.

Parameters

SensorInfo $sensor_info: Sensor info.

Return value

\Drupal\monitoring\Result\SensorResultInterface Instantiated sensor result object.

1 call to SensorRunner::getResultObject()
SensorRunner::runSensor in lib/Drupal/monitoring/SensorRunner.php
Run a single given sensor.

File

lib/Drupal/monitoring/SensorRunner.php, line 326
Contains \Drupal\monitoring\SensorRunner.

Class

SensorRunner
Instantiate and run requested sensors.

Namespace

Drupal\monitoring

Code

protected function getResultObject(SensorInfo $sensor_info) {
  $result_class = $sensor_info
    ->getResultClass();
  if (!$this->forceRun && isset($this->cache[$sensor_info
    ->getName()])) {
    $result = new $result_class($sensor_info, $this->cache[$sensor_info
      ->getName()]);
  }
  else {
    $result = new $result_class($sensor_info);
  }
  return $result;
}