You are here

public static function CronRule::factory in Ultimate Cron 7.2

Factory method for CronRule instance.

Parameters

string $rule: The crontab rule to use.

int $time: The time to test against.

int $skew: Skew for @ flag.

Return value

CronRule CronRule object.

7 calls to CronRule::factory()
UltimateCronCrontabScheduler::formatLabelVerbose in plugins/ultimate_cron/scheduler/crontab.class.php
Label for schedule.
UltimateCronCrontabScheduler::isBehind in plugins/ultimate_cron/scheduler/crontab.class.php
Determine if job is behind schedule.
UltimateCronCrontabScheduler::shouldRun in plugins/ultimate_cron/scheduler/crontab.class.php
Check crontab rules against times.
UltimateCronRulesUnitTestCase::getIntervals in tests/rules.test
UltimateCronRulesUnitTestCase::runTest in tests/rules.test

... See full list

File

./CronRule.class.php, line 42
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 static function factory($rule, $time = NULL, $skew = 0) {
  if (strpos($rule, '@') === FALSE) {
    $skew = 0;
  }
  $time = isset($time) ? (int) $time : time();
  $key = "{$rule}:{$time}:{$skew}";
  if (isset(self::$instances[$key])) {
    return self::$instances[$key];
  }
  self::$instances[$key] = new CronRule($rule, $time, $skew);
  return self::$instances[$key];
}