You are here

abstract class Sensor in Monitoring 7

Abstract SensorInterface implementation with common behaviour.

@todo more

Hierarchy

Expanded class hierarchy of Sensor

2 files declare their use of Sensor
SensorCoreRequirements.php in lib/Drupal/monitoring/Sensor/Sensors/SensorCoreRequirements.php
Contains \Drupal\monitoring\Sensor\Sensors\SensorCoreRequirements.
SensorDrupalUpdate.php in lib/Drupal/monitoring/Sensor/Sensors/SensorDrupalUpdate.php
Contains \Drupal\monitoring\Sensor\Sensors\SensorDrupalUpdate.
1 string reference to 'Sensor'
monitoring_drush_result_output_table_multiple in ./monitoring.drush.inc
Outputs sensor results table for multiple results.

File

lib/Drupal/monitoring/Sensor/Sensor.php, line 14
Contains \Drupal\monitoring\Sensor\Sensor.

Namespace

Drupal\monitoring\Sensor
View source
abstract class Sensor implements SensorInterface {

  /**
   * Current sensor info object.
   *
   * @var SensorInfo
   */
  protected $info;

  /**
   * Instantiates a sensor object.
   *
   * @param SensorInfo $info
   *   Sensor info object.
   */
  function __construct(SensorInfo $info) {
    $this->info = $info;
  }

  /**
   * {@inheritdoc}
   */
  public function getSensorName() {
    return $this->info
      ->getName();
  }

  /**
   * {@inheritdoc}
   */
  public function isEnabled() {
    return (bool) $this->info
      ->getSetting('enabled');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Sensor::$info protected property Current sensor info object.
Sensor::getSensorName public function Gets sensor name (not the label). Overrides SensorInterface::getSensorName
Sensor::isEnabled public function Determines if sensor is enabled. Overrides SensorInterface::isEnabled
Sensor::__construct function Instantiates a sensor object. 1
SensorInterface::runSensor function Runs the sensor, updating $sensor_result. 13