You are here

protected function SensorRunner::getSensorObject in Monitoring 7

Instantiates sensor object.

Parameters

SensorInfo $sensor_info: Sensor info.

Return value

\Drupal\monitoring\Sensor\SensorInterface Instantiated sensor.

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

File

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

Class

SensorRunner
Instantiate and run requested sensors.

Namespace

Drupal\monitoring

Code

protected function getSensorObject(SensorInfo $sensor_info) {
  $sensor_class = $sensor_info
    ->getSensorClass();
  $sensor = new $sensor_class($sensor_info);
  return $sensor;
}