You are here

public function CronRule::expandRange in Ultimate Cron 7.2

Same name and namespace in other branches
  1. 8 CronRule.class.php \CronRule::expandRange()
  2. 6 CronRule.class.php \CronRule::expandRange()
  3. 7 CronRule.class.php \CronRule::expandRange()

Expand range from cronrule part.

Parameters

string $part: Cronrule part, e.g.: 1,2,3,4-43/5.

string $type: Type of range (minutes, hours, etc.)

Return value

array Valid values for this range.

1 call to CronRule::expandRange()
CronRule::getIntervals in ./CronRule.class.php
Generate regex rules.

File

./CronRule.class.php, line 136
This class parses cron rules and determines last execution time using least case integer comparison.

Class

CronRule
@file This class parses cron rules and determines last execution time using least case integer comparison.

Code

public function expandRange($part, $type) {
  $this->type = $type;
  $part = preg_replace_callback('!(\\d+)(?:-(\\d+))?((/(\\d+))?(\\+(\\d+))?)?!', array(
    $this,
    'expandInterval',
  ), $part);
  if (!preg_match('/([^0-9\\,])/', $part)) {
    $part = explode(',', $part);
    rsort($part);
  }
  else {
    $part = array();
  }
  return $part;
}