CalendarSpec
in package
uses
CloneWith
FinalYes
CalendarSpec describes an event specification relative to the calendar, similar to a traditional cron specification, but with labeled fields.
Each field can be one of:
- *: matches always
- x: matches when the field equals x
- x/y: matches when the field equals x+n*y where n is an integer
- x-z: matches when the field is between x and z inclusive
- w,x,y,...: matches when the field is one of the listed values
Each x, y, z, ... is either a decimal integer, or a month or day of week name
or abbreviation (in the appropriate fields).
A timestamp matches if all fields match.
Note that fields have different default values, for convenience.
Note that the special case that some cron implementations have for treating
dayOfMonth
anddayOfWeek
as "or" instead of "and" when both are set is not implemented.dayOfWeek
can accept 0 or 7 as Sunday CalendarSpec gets compiled into StructuredCalendarSpec, which is what will be returned if you describe the schedule.
Tags
Table of Contents
Properties
- $comment : string
- $dayOfMonth : string
- $dayOfWeek : string
- $hour : string
- $minute : string
- $month : string
- $second : string
- $year : string
Methods
- new() : self
- withComment() : self
- withDayOfMonth() : self
- withDayOfWeek() : self
- withHour() : self
- withMinute() : self
- withMonth() : self
- withSecond() : self
- withYear() : self
- __construct() : mixed
Properties
$comment read-only
public
string
$comment
$dayOfMonth read-only
public
string
$dayOfMonth
$dayOfWeek read-only
public
string
$dayOfWeek
$hour read-only
public
string
$hour
$minute read-only
public
string
$minute
$month read-only
public
string
$month
$second read-only
public
string
$second
$year read-only
public
string
$year
Methods
new()
public
static new([string $second = '*' ][, string $minute = '*' ][, string $hour = '*' ][, string $dayOfMonth = '*' ][, string $month = '*' ][, string $year = '*' ][, string $dayOfWeek = '*' ][, string $comment = '' ]) : self
Parameters
- $second : string = '*'
-
Expression to match seconds.
- $minute : string = '*'
-
Expression to match minutes.
- $hour : string = '*'
-
Expression to match hours.
- $dayOfMonth : string = '*'
-
Expression to match days of the month.
- $month : string = '*'
-
Expression to match months.
- $year : string = '*'
-
Expression to match years.
- $dayOfWeek : string = '*'
-
Expression to match days of the week.
- $comment : string = ''
-
Free-form comment describing the intention of this spec.
Return values
selfwithComment()
public
withComment(string $comment) : self
Parameters
- $comment : string
Return values
selfwithDayOfMonth()
public
withDayOfMonth(string|int $dayOfMonth) : self
Parameters
- $dayOfMonth : string|int
Return values
selfwithDayOfWeek()
public
withDayOfWeek(string|int $dayOfWeek) : self
Parameters
- $dayOfWeek : string|int
Return values
selfwithHour()
public
withHour(string|int $hour) : self
Parameters
- $hour : string|int
Return values
selfwithMinute()
public
withMinute(string|int $minute) : self
Parameters
- $minute : string|int
Return values
selfwithMonth()
public
withMonth(string|int $month) : self
Parameters
- $month : string|int
Return values
selfwithSecond()
public
withSecond(string|int $second) : self
Parameters
- $second : string|int
Return values
selfwithYear()
public
withYear(string|int $year) : self
Parameters
- $year : string|int
Return values
self__construct()
private
__construct(string $second, string $minute, string $hour, string $dayOfMonth, string $month, string $year, string $dayOfWeek, string $comment) : mixed
Parameters
- $second : string
-
Expression to match seconds.
- $minute : string
-
Expression to match minutes.
- $hour : string
-
Expression to match hours.
- $dayOfMonth : string
-
Expression to match days of the month.
- $month : string
-
Expression to match months.
- $year : string
-
Expression to match years.
- $dayOfWeek : string
-
Expression to match days of the week.
- $comment : string
-
Free-form comment describing the intention of this spec.