PHP Class Recurr\Rule

http://www.ietf.org/rfc/rfc2445.txt Information, not contained in the built/parsed RRULE, necessary to determine the various recurrence instance start time and dates are derived from the DTSTART property (default: \DateTime()). For example, "FREQ=YEARLY;BYMONTH=1" doesn't specify a specific day within the month or a time. This information would be the same as what is specified for DTSTART. BYxxx rule parts modify the recurrence in some manner. BYxxx rule parts for a period of time which is the same or greater than the frequency generally reduce or limit the number of occurrences of the recurrence generated. For example, "FREQ=DAILY;BYMONTH=1" reduces the number of recurrence instances from all days (if BYMONTH tag is not present) to all days in January. BYxxx rule parts for a period of time less than the frequency generally increase or expand the number of occurrences of the recurrence. For example, "FREQ=YEARLY;BYMONTH=1,2" increases the number of days within the yearly recurrence set from 1 (if BYMONTH tag is not present) to 2. If multiple BYxxx rule parts are specified, then after evaluating the specified FREQ and INTERVAL rule parts, the BYxxx rule parts are applied to the current set of evaluated occurrences in the following order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR, BYMINUTE, BYSECOND and BYSETPOS; then COUNT and UNTIL are evaluated. Here is an example of evaluating multiple BYxxx rule parts. FREQ=YEARLY;INTERVAL=2;BYMONTH=1;BYDAY=SU;BYHOUR=8,9;BYMINUTE=30 First, the "INTERVAL=2" would be applied to "FREQ=YEARLY" to arrive at "every other year". Then, "BYMONTH=1" would be applied to arrive at "every January, every other year". Then, "BYDAY=SU" would be applied to arrive at "every Sunday in January, every other year". Then, "BYHOUR=8,9" would be applied to arrive at "every Sunday in January at 8 AM and 9 AM, every other year". Then, "BYMINUTE=30" would be applied to arrive at "every Sunday in January at 8:30 AM and 9:30 AM, every other year". Then, lacking information from RRULE, the second is derived from DTSTART, to end up in "every Sunday in January at 8:30:00 AM and 9:30:00 AM, every other year". Similarly, if the BYMINUTE, BYHOUR, BYDAY, BYMONTHDAY or BYMONTH rule part were missing, the appropriate minute, hour, day or month would have been retrieved from the "DTSTART" property. Example: The following is a rule which specifies 10 meetings which occur every other day: FREQ=DAILY;COUNT=10;INTERVAL=2
Author: Shaun Simmons ([email protected])
Afficher le fichier Open project: simshaun/recurr Class Usage Examples

Méthodes publiques

Свойство Type Description
$freqs

Protected Properties

Свойство Type Description
$byDay array
$byHour array
$byMinute array
$byMonth array
$byMonthDay array
$bySecond array
$bySetPosition integer
$byWeekNumber array
$byYearDay array
$count integer | null
$days array
$endDate DateTime | null
$exDates array
$freq string
$interval integer
$isExplicitInterval boolean
$isStartDateFromDtstart boolean
$rDates array
$startDate DateTime | null
$timezone string
$until DateTime | null
$weekStart string
$weekStartDefined

Méthodes publiques

Méthode Description
__construct ( string $rrule = null, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) Construct a new Rule.
createFromArray ( array $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule Create a Rule object based on a RRULE array.
createFromString ( string $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule Create a Rule object based on a RRULE string.
getByDay ( ) : array Get an array of days of the week (SU, MO, TU, .
getByDayTransformedToWeekdays ( ) : array Get an array of Weekdays
getByHour ( ) : array Get an array of hours of the day.
getByMinute ( ) : array Get an array of minutes within an hour.
getByMonth ( ) : array Get an array of months of the year.
getByMonthDay ( ) : array Get an array of days of the month.
getBySecond ( ) : array Get an array of seconds within a minute.
getBySetPosition ( ) : array Get the array of values which corresponds to the nth occurrence within the set of events specified by the rule.
getByWeekNumber ( ) : array Get an array of ordinals specifying weeks of the year.
getByYearDay ( ) : array Get an array of days of the year.
getCount ( ) : integer | null Get the number of occurrences at which the recurrence is range-bound.
getEndDate ( ) : DateTime
getExDates ( ) : recurr\DateExclusion[] Get the array of dates that will not be included in a recurrence set.
getFreq ( ) : integer Get the type of recurrence rule (as integer).
getFreqAsText ( ) : string Get the type of recurrence rule (as text).
getInterval ( ) : integer Get the interval that represents how often the recurrence rule repeats.
getRDates ( ) : recurr\DateInclusion[] Get the array of dates that will be included in a recurrence set.
getStartDate ( ) : DateTime
getString ( $timezoneType = self::TZ_FLOAT ) : string Get the RRULE as a string
getTimezone ( ) : null | string Get timezone to use for \DateTime() objects that are UTC.
getUntil ( ) : DateTime | null Get the \DateTime that the recurrence lasts until.
getWeekStart ( ) : string Get the day on which the workweek starts.
getWeekStartAsNum ( ) : integer Get the day on which the workweek starts, as an integer from 0-6, 0 being Monday and 6 being Sunday.
hasByMonth ( )
loadFromArray ( $parts ) : Rule Populate the object based on a RRULE array.
loadFromString ( string $rrule ) : Rule Populate the object based on a RRULE string.
setByDay ( array $byDay ) This rule specifies an array of days of the week;
setByHour ( array $byHour ) This rule specifies an array of hours of the day.
setByMinute ( array $byMinute ) This rule specifies an array of minutes within an hour.
setByMonth ( array $byMonth ) This rule specifies an array of months of the year.
setByMonthDay ( array $byMonthDay ) This rule specifies an array of days of the month.
setBySecond ( array $bySecond ) This rule specifies an array of seconds within a minute.
setBySetPosition ( array $bySetPosition ) This rule specifies an array of values which corresponds to the nth occurrence within the set of events specified by the rule. Valid values are 1 to 366 or -366 to -1. It MUST only be used in conjunction with another BYxxx rule part.
setByWeekNumber ( array $byWeekNumber ) This rule specifies an array of ordinals specifying weeks of the year.
setByYearDay ( array $byYearDay ) This rule specifies an array of days of the year.
setCount ( integer $count ) The count defines the number of occurrences at which to range-bound the recurrence. The DTSTART counts as the first occurrence.
setEndDate ( DateTime | null $endDate ) This date specifies the last possible instance in the recurrence set.
setExDates ( array $exDates ) This rule specifies an array of exception dates that will not be included in a recurrence set.
setFreq ( string $freq ) Identifies the type of recurrence rule.
setInterval ( integer $interval ) The interval represents how often the recurrence rule repeats.
setRDates ( array $rDates ) This rule specifies an array of dates that will be included in a recurrence set.
setStartDate ( DateTime | null $startDate, boolean | null $includeInString = null ) This date specifies the first instance in the recurrence set.
setTimezone ( string $timezone )
setUntil ( DateTime $until ) Define a \DateTime value which bounds the recurrence rule in an inclusive manner. If the value specified is synchronized with the specified recurrence, this DateTime becomes the last instance of the recurrence. If not present, and a COUNT is also not present, the RRULE is considered to repeat forever.
setWeekStart ( string $weekStart ) This rule specifies the day on which the workweek starts.

Private Methods

Méthode Description
convertZtoUtc ( DateTime $date ) : DateTime DateTime::setTimezone fails if the timezone does not have an ID.

Method Details

__construct() public méthode

Construct a new Rule.
public __construct ( string $rrule = null, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null )
$rrule string RRULE string
$startDate string | DateTime
$endDate DateTime | null
$timezone string

createFromArray() public static méthode

Create a Rule object based on a RRULE array.
public static createFromArray ( array $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule
$rrule array RRULE array
$startDate string | DateTime
$endDate DateTime | null
$timezone string
Résultat Rule

createFromString() public static méthode

Create a Rule object based on a RRULE string.
public static createFromString ( string $rrule, string | DateTime $startDate = null, DateTime | null $endDate = null, string $timezone = null ) : Rule
$rrule string RRULE string
$startDate string | DateTime
$endDate DateTime | null
$timezone string
Résultat Rule

getByDay() public méthode

.)
public getByDay ( ) : array
Résultat array

getByDayTransformedToWeekdays() public méthode

Get an array of Weekdays
public getByDayTransformedToWeekdays ( ) : array
Résultat array of Weekdays

getByHour() public méthode

Get an array of hours of the day.
public getByHour ( ) : array
Résultat array

getByMinute() public méthode

Get an array of minutes within an hour.
public getByMinute ( ) : array
Résultat array

getByMonth() public méthode

Get an array of months of the year.
public getByMonth ( ) : array
Résultat array

getByMonthDay() public méthode

Get an array of days of the month.
public getByMonthDay ( ) : array
Résultat array

getBySecond() public méthode

Get an array of seconds within a minute.
public getBySecond ( ) : array
Résultat array

getBySetPosition() public méthode

Get the array of values which corresponds to the nth occurrence within the set of events specified by the rule.
public getBySetPosition ( ) : array
Résultat array

getByWeekNumber() public méthode

Get an array of ordinals specifying weeks of the year.
public getByWeekNumber ( ) : array
Résultat array

getByYearDay() public méthode

Get an array of days of the year.
public getByYearDay ( ) : array
Résultat array

getCount() public méthode

Get the number of occurrences at which the recurrence is range-bound.
public getCount ( ) : integer | null
Résultat integer | null

getEndDate() public méthode

public getEndDate ( ) : DateTime
Résultat DateTime

getExDates() public méthode

Get the array of dates that will not be included in a recurrence set.
public getExDates ( ) : recurr\DateExclusion[]
Résultat recurr\DateExclusion[]

getFreq() public méthode

Get the type of recurrence rule (as integer).
public getFreq ( ) : integer
Résultat integer

getFreqAsText() public méthode

Get the type of recurrence rule (as text).
public getFreqAsText ( ) : string
Résultat string

getInterval() public méthode

Get the interval that represents how often the recurrence rule repeats.
public getInterval ( ) : integer
Résultat integer

getRDates() public méthode

Get the array of dates that will be included in a recurrence set.
public getRDates ( ) : recurr\DateInclusion[]
Résultat recurr\DateInclusion[]

getStartDate() public méthode

public getStartDate ( ) : DateTime
Résultat DateTime

getString() public méthode

Get the RRULE as a string
public getString ( $timezoneType = self::TZ_FLOAT ) : string
Résultat string

getTimezone() public méthode

Get timezone to use for \DateTime() objects that are UTC.
public getTimezone ( ) : null | string
Résultat null | string

getUntil() public méthode

Get the \DateTime that the recurrence lasts until.
public getUntil ( ) : DateTime | null
Résultat DateTime | null

getWeekStart() public méthode

Get the day on which the workweek starts.
public getWeekStart ( ) : string
Résultat string

getWeekStartAsNum() public méthode

Get the day on which the workweek starts, as an integer from 0-6, 0 being Monday and 6 being Sunday.
public getWeekStartAsNum ( ) : integer
Résultat integer

hasByMonth() public méthode

public hasByMonth ( )

loadFromArray() public méthode

Populate the object based on a RRULE array.
public loadFromArray ( $parts ) : Rule
Résultat Rule

loadFromString() public méthode

Populate the object based on a RRULE string.
public loadFromString ( string $rrule ) : Rule
$rrule string RRULE string
Résultat Rule

setByDay() public méthode

MO indicates Monday; TU indicates Tuesday; WE indicates Wednesday; TH indicates Thursday; FR indicates Friday; SA indicates Saturday; SU indicates Sunday. Each BYDAY value can also be preceded by a positive (+n) or negative (-n) integer. If present, this indicates the nth occurrence of the specific day within the MONTHLY or YEARLY RRULE. For example, within a MONTHLY rule, +1MO (or simply 1MO) represents the first Monday within the month, whereas -1MO represents the last Monday of the month. If an integer modifier is not present, it means all days of this type within the specified frequency. For example, within a MONTHLY rule, MO represents all Mondays within the month. ------------------------------------------- DO NOT MIX DAYS AND DAYS WITH MODIFIERS. This is not supported. -------------------------------------------
public setByDay ( array $byDay )
$byDay array Array of days of the week

setByHour() public méthode

Valid values are 0 to 23.
public setByHour ( array $byHour )
$byHour array Array of hours of the day

setByMinute() public méthode

Valid values are 0 to 59.
public setByMinute ( array $byMinute )
$byMinute array Array of minutes within an hour

setByMonth() public méthode

Valid values are 1 to 12.
public setByMonth ( array $byMonth )
$byMonth array Array of months of the year from 1 to 12

setByMonthDay() public méthode

Valid values are 1 to 31 or -31 to -1. For example, -10 represents the tenth to the last day of the month.
public setByMonthDay ( array $byMonthDay )
$byMonthDay array Array of days of the month from -31 to 31

setBySecond() public méthode

Valid values are 0 to 59.
public setBySecond ( array $bySecond )
$bySecond array Array of seconds within a minute

setBySetPosition() public méthode

For example "the last work day of the month" could be represented as: RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1 Each BYSETPOS value can include a positive or negative integer. If present, this indicates the nth occurrence of the specific occurrence within the set of events specified by the rule.
public setBySetPosition ( array $bySetPosition )
$bySetPosition array Array of values which corresponds to the nth occurrence within the set of events specified by the rule.

setByWeekNumber() public méthode

Valid values are 1 to 53 or -53 to -1. This corresponds to weeks according to week numbering as defined in [ISO 8601]. A week is defined as a seven day period, starting on the day of the week defined to be the week start (see setWeekStart). Week number one of the calendar year is the first week which contains at least four days in that calendar year. This rule is only valid for YEARLY rules. For example, 3 represents the third week of the year. Note: Assuming a Monday week start, week 53 can only occur when Thursday is January 1 or if it is a leap year and Wednesday is January 1.
public setByWeekNumber ( array $byWeekNumber )
$byWeekNumber array Array of ordinals specifying weeks of the year.

setByYearDay() public méthode

Valid values are 1 to 366 or -366 to -1. For example, -1 represents the last day of the year (December 31st) and -306 represents the 306th to the last day of the year (March 1st).
public setByYearDay ( array $byYearDay )
$byYearDay array Array of days of the year from -1 to 306

setCount() public méthode

Either COUNT or UNTIL may be specified, but COUNT and UNTIL MUST NOT both be specified.
public setCount ( integer $count )
$count integer Number of occurrences

setEndDate() public méthode

This date specifies the last possible instance in the recurrence set.
public setEndDate ( DateTime | null $endDate )
$endDate DateTime | null Date of the last possible instance in the recurrence

setExDates() public méthode

This rule specifies an array of exception dates that will not be included in a recurrence set.
public setExDates ( array $exDates )
$exDates array Array of dates that will not be included in the recurrence set.

setFreq() public méthode

May be one of: - Frequency::SECONDLY to specify repeating events based on an interval of a second or more. - Frequency::MINUTELY to specify repeating events based on an interval of a minute or more. - Frequency::HOURLY to specify repeating events based on an interval of an hour or more. - Frequency::DAILY to specify repeating events based on an interval of a day or more. - Frequency::WEEKLY to specify repeating events based on an interval of a week or more. - Frequency::MONTHLY to specify repeating events based on an interval of a month or more. - Frequency::YEAR to specify repeating events based on an interval of a year or more.
public setFreq ( string $freq )
$freq string Frequency of recurrence.

setInterval() public méthode

The default value is "1", meaning every second for a SECONDLY rule, or every minute for a MINUTELY rule, every hour for an HOURLY rule, every day for a DAILY rule, every week for a WEEKLY rule, every month for a MONTHLY rule and every year for a YEARLY rule.
public setInterval ( integer $interval )
$interval integer Positive integer that represents how often the recurrence rule repeats.

setRDates() public méthode

This rule specifies an array of dates that will be included in a recurrence set.
public setRDates ( array $rDates )
$rDates array Array of dates that will be included in the recurrence set.

setStartDate() public méthode

This date specifies the first instance in the recurrence set.
public setStartDate ( DateTime | null $startDate, boolean | null $includeInString = null )
$startDate DateTime | null Date of the first instance in the recurrence
$includeInString boolean | null If true, include as DTSTART when calling getString()

setTimezone() public méthode

See also: http://www.php.net/manual/en/timezones.php
public setTimezone ( string $timezone )
$timezone string

setUntil() public méthode

Either UNTIL or COUNT may be specified, but UNTIL and COUNT MUST NOT both be specified.
public setUntil ( DateTime $until )
$until DateTime The upper bound of the recurrence.

setWeekStart() public méthode

Valid values are MO, TU, WE, TH, FR, SA and SU. This is significant when a WEEKLY RRULE has an interval greater than 1, and a BYDAY rule part is specified. This is also significant when in a YEARLY RRULE when a BYWEEKNO rule is specified. The default value is MO.
public setWeekStart ( string $weekStart )
$weekStart string The day on which the workweek starts.

Property Details

$byDay protected_oe property

protected array $byDay
Résultat array

$byHour protected_oe property

protected array $byHour
Résultat array

$byMinute protected_oe property

protected array $byMinute
Résultat array

$byMonth protected_oe property

protected array $byMonth
Résultat array

$byMonthDay protected_oe property

protected array $byMonthDay
Résultat array

$bySecond protected_oe property

protected array $bySecond
Résultat array

$bySetPosition protected_oe property

protected int $bySetPosition
Résultat integer

$byWeekNumber protected_oe property

protected array $byWeekNumber
Résultat array

$byYearDay protected_oe property

protected array $byYearDay
Résultat array

$count protected_oe property

protected int|null $count
Résultat integer | null

$days protected_oe property

protected array $days
Résultat array

$endDate protected_oe property

protected DateTime|null $endDate
Résultat DateTime | null

$exDates protected_oe property

protected array $exDates
Résultat array

$freq protected_oe property

protected string $freq
Résultat string

$freqs public_oe static_oe property

public static $freqs

$interval protected_oe property

protected int $interval
Résultat integer

$isExplicitInterval protected_oe property

protected bool $isExplicitInterval
Résultat boolean

$isStartDateFromDtstart protected_oe property

protected bool $isStartDateFromDtstart
Résultat boolean

$rDates protected_oe property

protected array $rDates
Résultat array

$startDate protected_oe property

protected DateTime|null $startDate
Résultat DateTime | null

$timezone protected_oe property

protected string $timezone
Résultat string

$until protected_oe property

protected DateTime|null $until
Résultat DateTime | null

$weekStart protected_oe property

protected string $weekStart
Résultat string

$weekStartDefined protected_oe property

protected $weekStartDefined