You are here

public function SensorResult::toArray in Monitoring 8

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

Returns sensor result data as array.

Return value

array An array with data having following keys:

  • sensor_name
  • value
  • expected_value
  • numeric_value
  • status
  • message
  • execution_time
  • timestamp

Overrides SensorResultInterface::toArray

File

src/Result/SensorResult.php, line 470

Class

SensorResult
Generic container for the sensor result.

Namespace

Drupal\monitoring\Result

Code

public function toArray() {
  return array(
    'sensor_name' => $this
      ->getSensorId(),
    'value' => $this
      ->getValue(),
    'expected_value' => $this
      ->getExpectedValue(),
    'numeric_value' => $this
      ->toNumber(),
    'status' => $this
      ->getStatus(),
    'message' => $this
      ->getMessage(),
    'execution_time' => $this
      ->getExecutionTime(),
    'timestamp' => $this
      ->getTimestamp(),
  );
}