You are here

public static function CronRule::factory in Ultimate Cron 8.2

Factory method for CronRule instance.

Parameters

string $rule: The crontab rule to use.

integer $time: The time to test against.

integer $skew: Skew for @ flag.

Return value

CronRule CronRule object.

8 calls to CronRule::factory()
CronJobInstallTest::testRequirements in tests/src/Functional/CronJobInstallTest.php
Tests the requirements checking of ultimate_cron.
CronJobTest::testGeneratedJob in tests/src/Kernel/CronJobTest.php
Tests adding and editing a cron job.
Crontab::formatLabelVerbose in src/Plugin/ultimate_cron/Scheduler/Crontab.php
Label for schedule.
Crontab::isBehind in src/Plugin/ultimate_cron/Scheduler/Crontab.php
Check if job is behind schedule.
Crontab::shouldRun in src/Plugin/ultimate_cron/Scheduler/Crontab.php

... See full list

File

src/CronRule.php, line 39

Class

CronRule

Namespace

Drupal\ultimate_cron

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