You are here

public function SensorResult::getValue in Monitoring 8

Same name and namespace in other branches
  1. 7 lib/Drupal/monitoring/Result/SensorResult.php \Drupal\monitoring\Result\SensorResult::getValue()

Gets the sensor metric value.

Return value

mixed Whatever value the sensor is supposed to return.

Overrides SensorResultDataInterface::getValue

5 calls to SensorResult::getValue()
SensorResult::assessComparison in src/Result/SensorResult.php
Performs comparison of expected and actual sensor values.
SensorResult::assessThresholds in src/Result/SensorResult.php
Deal with thresholds.
SensorResult::compile in src/Result/SensorResult.php
Compiles added status messages sets the status.
SensorResult::toArray in src/Result/SensorResult.php
Returns sensor result data as array.
SensorResult::toNumber in src/Result/SensorResult.php
Casts/processes the sensor value into numeric representation.

File

src/Result/SensorResult.php, line 361

Class

SensorResult
Generic container for the sensor result.

Namespace

Drupal\monitoring\Result

Code

public function getValue() {
  if ($this
    ->getSensorConfig()
    ->isBool()) {
    return (bool) $this
      ->getResultData('sensor_value');
  }
  return $this
    ->getResultData('sensor_value');
}