public function SensorManager::getSensorInfoByName in Monitoring 7
Returns monitoring sensor info for a given sensor.
Parameters
string $sensor_name: Sensor id.
Return value
\Drupal\monitoring\Sensor\SensorInfo A single SensorInfo instance.
Throws
\Drupal\monitoring\Sensor\NonExistingSensorException Thrown if the requested sensor does not exist.
2 calls to SensorManager::getSensorInfoByName()
- SensorManager::disableSensor in lib/
Drupal/ monitoring/ Sensor/ SensorManager.php - Disable a sensor.
- SensorManager::enableSensor in lib/
Drupal/ monitoring/ Sensor/ SensorManager.php - Enable a sensor.
File
- lib/
Drupal/ monitoring/ Sensor/ SensorManager.php, line 70 - Contains \Drupal\monitoring\Sensor\SensorManager.
Class
- SensorManager
- Manages sensor definitions and settings.
Namespace
Drupal\monitoring\SensorCode
public function getSensorInfoByName($sensor_name) {
$info = $this
->getSensorInfo();
if (isset($info[$sensor_name])) {
return $info[$sensor_name];
}
throw new NonExistingSensorException(format_string('Sensor @sensor_name does not exist', array(
'@sensor_name' => $sensor_name,
)));
}