You are here

public static function JobSchedulerCronTab::values in Job Scheduler 7.2

Parse array of values, check whether this is valid.

2 calls to JobSchedulerCronTab::values()
JobSchedulerCronTab::parse in ./JobSchedulerCronTab.inc
Parse full crontab string into an array of type => values.
JobSchedulerCronTab::__construct in ./JobSchedulerCronTab.inc
Constructor.

File

./JobSchedulerCronTab.inc, line 68
JobSchedulerCronTab class.

Class

JobSchedulerCronTab
Jose's cron tab parser = Better try only simple crontab strings.

Code

public static function values($array) {
  if (count($array) == 5) {
    $values = array_combine(array(
      'minutes',
      'hours',
      'mday',
      'mon',
      'wday',
    ), array_map('trim', $array));
    $elements = array();
    foreach ($values as $type => $string) {
      $elements[$type] = self::parseElement($type, $string, TRUE);
    }

    // Return only if we have the right number of elements
    // Dangerous means works running every second or things like that.
    if (count(array_filter($elements)) == 5) {
      return $elements;
    }
  }
  return NULL;
}