You are here

public static function JobSchedulerCronTab::parse in Job Scheduler 8.3

Same name and namespace in other branches
  1. 8.2 src/JobSchedulerCronTab.php \Drupal\job_scheduler\JobSchedulerCronTab::parse()

Parses a full crontab string into an array of type => values.

Note this one is static and can be used to validate values.

Parameters

string $crontab: The crontab string to parse.

Return value

array The parsed crontab array.

Overrides JobSchedulerCronTabInterface::parse

1 call to JobSchedulerCronTab::parse()
JobSchedulerCronTab::__construct in src/JobSchedulerCronTab.php
Constructs a JobSchedulerCronTab object.

File

src/JobSchedulerCronTab.php, line 46

Class

JobSchedulerCronTab
Class for job scheduler crontab.

Namespace

Drupal\job_scheduler

Code

public static function parse($crontab) {

  // Replace multiple spaces by single space.
  $crontab = preg_replace('/(\\s+)/', ' ', $crontab);

  // Expand into elements and parse all.
  $values = explode(' ', trim($crontab));
  return self::values($values);
}