TYPO3 CMS  TYPO3_7-6
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 normalize ($cronCommand)
 

Static Protected Member Functions

static convertKeywordsToCronCommand ($cronCommand)
 
static normalizeFields ($cronCommand)
 
static splitFields ($cronCommand)
 
static normalizeMonthAndWeekdayField ($expression, $isMonthField=true)
 
static normalizeIntegerField ($expression, $lowerBound=0, $upperBound=59)
 
static convertRangeToListOfValues ($range)
 
static reduceListOfValuesByStepValue ($stepExpression)
 
static normalizeMonthAndWeekday ($expression, $isMonth=true)
 
static normalizeMonth ($month)
 
static 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 26 of file NormalizeCommand.php.

Member Function Documentation

◆ convertKeywordsToCronCommand()

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

Accept special cron command keywords and convert to standard cron syntax. Allowed keywords: , , , , , ,

Parameters
string$cronCommandCron command
Returns
string Normalized cron command if keyword was found, else unchanged cron command

Definition at line 55 of file NormalizeCommand.php.

◆ convertRangeToListOfValues()

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

Convert a range of integers to a list: 4-6 results in a string '4,5,6'

Exceptions

Definition at line 217 of file NormalizeCommand.php.

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

◆ normalize()

static 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.

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

◆ normalizeFields()

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

Normalize cron command field to list of integers or *

Parameters
string$cronCommandcron command
Returns
string Normalized cron command

Definition at line 86 of file NormalizeCommand.php.

◆ normalizeIntegerField()

static TYPO3\CMS\Scheduler\CronCommand\NormalizeCommand::normalizeIntegerField (   $expression,
  $lowerBound = 0,
  $upperBound = 59 
)
staticprotected

Normalize integer field.

Exceptions

Definition at line 166 of file NormalizeCommand.php.

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

◆ normalizeMonth()

static 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

Definition at line 325 of file NormalizeCommand.php.

◆ normalizeMonthAndWeekday()

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

Dispatcher method for normalizeMonth and normalizeWeekday

Parameters
string$expressionMonth or weekday to be normalized
bool$isMonthTRUE if a month is handled, FALSE for weekday
Returns
string normalized month or weekday

Definition at line 311 of file NormalizeCommand.php.

◆ normalizeMonthAndWeekdayField()

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

Normalize month field.

Parameters
string$expressionMonth field expression
bool$isMonthFieldTRUE if month field is handled, FALSE for weekday field
Returns
string Normalized expression

Definition at line 121 of file NormalizeCommand.php.

◆ normalizeWeekday()

static 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

Definition at line 343 of file NormalizeCommand.php.

◆ reduceListOfValuesByStepValue()

static 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

Definition at line 261 of file NormalizeCommand.php.

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

◆ splitFields()

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

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

Exceptions

Definition at line 105 of file NormalizeCommand.php.