You are here

class Time in Node Revision Delete 8

Provides module internal helper methods.

Hierarchy

  • class \Drupal\node_revision_delete\Utility\Time

Expanded class hierarchy of Time

3 files declare their use of Time
NodeRevisionDeleteCommands.php in src/Commands/NodeRevisionDeleteCommands.php
node_revision_delete.drush.inc in ./node_revision_delete.drush.inc
Drush commands related to the Node Revision Delete module.
TimeTest.php in tests/src/Unit/Utility/TimeTest.php

File

src/Utility/Time.php, line 10

Namespace

Drupal\node_revision_delete\Utility
View source
class Time {

  /**
   * Return a mapping of the old word values to numeric equivalents.
   *
   * @param string $word
   *   The old word to map.
   *
   * @return array|string
   *   The numeric value when a word is provided or the whole map.
   */
  public static function convertWordToTime($word = NULL) {
    $word_map = [
      'never' => '-1',
      'every_time' => '0',
      'every_hour' => '3600',
      'everyday' => '86400',
      'every_week' => '604800',
      'every_10_days' => '864000',
      'every_15_days' => '1296000',
      'every_month' => '2592000',
      'every_3_months' => '7776000',
      'every_6_months' => '15552000',
      'every_year' => '31536000',
      'every_2_years' => '63072000',
    ];
    return empty($word) ? $word_map : $word_map[$word];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Time::convertWordToTime public static function Return a mapping of the old word values to numeric equivalents.