You are here

protected function DatabaseAggregatorSensorPluginBase::getTimeIntervalOptions in Monitoring 8

Returns time interval options.

Return value

array Array with time interval options, keyed by time interval in seconds.

1 call to DatabaseAggregatorSensorPluginBase::getTimeIntervalOptions()
DatabaseAggregatorSensorPluginBase::buildConfigurationForm in src/SensorPlugin/DatabaseAggregatorSensorPluginBase.php
Form constructor.

File

src/SensorPlugin/DatabaseAggregatorSensorPluginBase.php, line 150
Contains \Drupal\monitoring\SensorPlugin\DatabaseAggregatorSensorPluginBase.

Class

DatabaseAggregatorSensorPluginBase
Base class for database aggregator sensors.

Namespace

Drupal\monitoring\SensorPlugin

Code

protected function getTimeIntervalOptions() {
  $time_intervals = array(
    600,
    900,
    1800,
    3600,
    7200,
    10800,
    21600,
    32400,
    43200,
    64800,
    86400,
    172800,
    259200,
    604800,
    1209600,
    2419200,
  );
  $date_formatter = \Drupal::service('date.formatter');
  return array_map(array(
    $date_formatter,
    'formatInterval',
  ), array_combine($time_intervals, $time_intervals)) + array(
    0 => t('No restriction'),
  );
}