You are here

public function CronRule::expandRange in Ultimate Cron 8.2

Expand range from cronrule part.

Parameters

string $rule: 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 src/CronRule.php
Generate regex rules.

File

src/CronRule.php, line 132

Class

CronRule

Namespace

Drupal\ultimate_cron

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;
}