‪TYPO3CMS  ‪main
TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand Class Reference
Inheritance diagram for TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand:
TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy

Static Public Member Functions

static string normalize ($cronCommand)
 

Static Protected Member Functions

static string convertKeywordsToCronCommand ($cronCommand)
 
static string normalizeFields ($cronCommand)
 
static array splitFields ($cronCommand)
 
static string normalizeMonthAndWeekdayField ($expression, $isMonthField=true)
 
static string normalizeIntegerField ($expression, $lowerBound=0, $upperBound=59)
 
static string convertRangeToListOfValues ($range)
 
static string reduceListOfValuesByStepValue ($stepExpression)
 
static string normalizeMonthAndWeekday ($expression, $isMonth=true)
 
static int normalizeMonth ($month)
 
static int normalizeWeekday ($weekday)
 

Detailed Description

Validate and normalize a cron command.

Special fields like three letter weekdays, ranges and steps are substituted to a comma separated list of integers. Example: '2-4 10-40/10 * mar * fri' will be normalized to '2,4 10,20,30,40 * * 3 1,2'

Definition at line 27 of file NormalizeCommand.php.

Member Function Documentation

◆ convertKeywordsToCronCommand()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::convertKeywordsToCronCommand (   $cronCommand)
staticprotected

Accept special cron command keywords and convert to standard cron syntax. Allowed keywords: @yearly, @annually, @monthly, @weekly, @daily, @midnight, @hourly

Parameters
string$cronCommand‪Cron command
Returns
‪string Normalized cron command if keyword was found, else unchanged cron command

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 55 of file NormalizeCommand.php.

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalize().

◆ convertRangeToListOfValues()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::convertRangeToListOfValues (   $range)
staticprotected

◆ normalize()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalize (   $cronCommand)
static

Main API method: Get the cron command and normalize it.

If no exception is thrown, the resulting cron command is validated and consists of five whitespace separated fields, which are either the letter '*' or a sorted, unique comma separated list of integers.

Exceptions

Definition at line 40 of file NormalizeCommand.php.

References TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\convertKeywordsToCronCommand(), and TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeFields().

Referenced by TYPO3\CMS\Scheduler\CronCommand\CronCommand\__construct(), TYPO3\CMS\Scheduler\Controller\SchedulerModuleController\isSubmittedTaskDataValid(), and TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\NormalizeCommandTest\normalizeConvertsCronCommand().

◆ normalizeFields()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalizeFields (   $cronCommand)
staticprotected

◆ normalizeIntegerField()

◆ normalizeMonth()

static int TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalizeMonth (   $month)
staticprotected

Accept a string representation or integer number of a month like 'jan', 'February', 01, ... and convert to normalized integer value 1 .. 12

Exceptions

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 327 of file NormalizeCommand.php.

References TYPO3\CMS\Scheduler\CronCommand\CronCommand\$timestamp.

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeMonthAndWeekday().

◆ normalizeMonthAndWeekday()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalizeMonthAndWeekday (   $expression,
  $isMonth = true 
)
staticprotected

Dispatcher method for normalizeMonth and normalizeWeekday

Parameters
string$expression‪Month or weekday to be normalized
bool$isMonth‪TRUE if a month is handled, FALSE for weekday
Returns
‪string normalized month or weekday

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 313 of file NormalizeCommand.php.

References TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeMonth(), and TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeWeekday().

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeMonthAndWeekdayField().

◆ normalizeMonthAndWeekdayField()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalizeMonthAndWeekdayField (   $expression,
  $isMonthField = true 
)
staticprotected

Normalize month field.

Parameters
string$expression‪Month field expression
bool$isMonthField‪TRUE if month field is handled, FALSE for weekday field
Returns
‪string Normalized expression

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 121 of file NormalizeCommand.php.

References TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeIntegerField(), and TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeMonthAndWeekday().

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeFields().

◆ normalizeWeekday()

static int TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalizeWeekday (   $weekday)
staticprotected

Accept a string representation or integer number of a weekday like 'mon', 'Friday', 3, ... and convert to normalized integer value 1 .. 7

Exceptions

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 345 of file NormalizeCommand.php.

References TYPO3\CMS\Scheduler\CronCommand\CronCommand\$timestamp.

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeMonthAndWeekday().

◆ reduceListOfValuesByStepValue()

static string TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::reduceListOfValuesByStepValue (   $stepExpression)
staticprotected

Reduce a given list of values by step value. Following a range with `‘/<number>’' specifies skips of the number's value through the range. 1-5/2 -> 1,3,5 2-10/3 -> 2,5,8

Exceptions

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 263 of file NormalizeCommand.php.

References TYPO3\CMS\Core\Utility\MathUtility\canBeInterpretedAsInteger().

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeIntegerField().

◆ splitFields()

static array TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::splitFields (   $cronCommand)
staticprotected

Split a given cron command like '23 * * * *' to an array with five fields.

Exceptions

Reimplemented in TYPO3\CMS\Scheduler\Tests\Unit\CronCommand\AccessibleProxies\NormalizeCommandAccessibleProxy.

Definition at line 105 of file NormalizeCommand.php.

References $fields.

Referenced by TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand\normalizeFields().