function CronRule::expandRange in Ultimate Cron 6
Same name and namespace in other branches
- 8 CronRule.class.php \CronRule::expandRange()
- 7.2 CronRule.class.php \CronRule::expandRange()
- 7 CronRule.class.php \CronRule::expandRange()
Expand range from cronrule part
Parameters
$rule: (string) cronrule part, e.g.: 1,2,3,4-43/5
$max: (string) boundaries, e.g.: 0-59
$digits: (int) number of digits of value (leading zeroes)
Return value
(array) array of valid values
1 call to CronRule::expandRange()
- CronRule::getIntervals in ./
CronRule.class.php - Generate regex rules
File
- ./
CronRule.class.php, line 72 - This class parses cron rules and determines last execution time using least case integer comparison.
Class
- CronRule
- @file
Code
function expandRange($rule, $type) {
$this->type = $type;
$max = implode('-', self::$ranges[$type]);
$rule = str_replace("*", $max, $rule);
$rule = str_replace("@", $this->offset % (self::$ranges[$type][1] + 1), $rule);
$this->parsed_rule[$type] = $rule;
$rule = preg_replace_callback('!(\\d+)(?:-(\\d+))?((/(\\d+))?(\\+(\\d+))?)?!', array(
$this,
'expandInterval',
), $rule);
if (!preg_match('/([^0-9\\,])/', $rule)) {
$rule = explode(',', $rule);
rsort($rule);
}
else {
$rule = array();
}
return $rule;
}