You are here

protected function SensorRunner::getResultObject in Monitoring 8

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

Instantiates sensor result object.

Parameters

\Drupal\monitoring\Entity\SensorConfig $sensor_config: Sensor config.

Return value

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

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

File

src/SensorRunner.php, line 306
Contains \Drupal\monitoring\SensorRunner.

Class

SensorRunner
Instantiate and run requested sensors.

Namespace

Drupal\monitoring

Code

protected function getResultObject(SensorConfig $sensor_config) {
  $result_class = '\\Drupal\\monitoring\\Result\\SensorResult';
  if (!$this->forceRun && isset($this->sensorResultCache[$sensor_config
    ->id()])) {
    $result = new $result_class($sensor_config, $this->sensorResultCache[$sensor_config
      ->id()]);
  }
  else {
    $result = new $result_class($sensor_config);
  }
  return $result;
}