Class Freq
A class to store Frequency-rules in. Will allow a easy way to find the last and next occurrence of the rule.
No - this is so not pretty. But.. ehh.. You do it better, and I will gladly accept patches.
Created by trail-and-error on the examples given in the RFC.
TODO: Update to a better way of doing calculating the different options. Instead of only keeping track of the best of the current dates found it should instead keep a array of all the calculated dates within the period. This should fix the issues with multi-rule + multi-rule interference, and make it possible to implement the SETPOS rule. By pushing the next period onto the stack as the last option will (hopefully) remove the need for the awful simpleMode
License: CC-BY-SA-DK
Author: Morten Fangel (C) 2008
Author: Michael Kahn (C) 2013
Located at ical/Freq.php
public
|
#
__construct( mixed $rule, mixed $start, mixed $excluded = array(), mixed $added = array() )
Constructs a new Freqency-rule |
public
array
|
|
public
integer
|
#
previousOccurrence( integer $offset )
Returns the previous (most recent) occurrence of the rule from the given offset |
public
integer
|
|
public
integer
|
|
public
integer
|
#
lastOccurrence( )
Finds the absolute last occurrence of the rule from the given offset. Builds also the cache, if not set before... |
public
integer
|
|
public
integer
|
protected
array
|
$weekdays | array('MO'=>'monday', 'TU'=>'tuesday', 'WE'=>'wednesday', 'TH'=>'thursday', 'FR'=>'friday', 'SA'=>'saturday', 'SU'=>'sunday') |
|
protected
array
|
$knownRules | array('month', 'weekno', 'day', 'monthday', 'yearday', 'hour', 'minute') |
|
protected
array
|
$ruleModifiers | array('wkst') |
|
protected
boolean
|
$simpleMode | true |
|
protected
array
|
$rules | array('freq'=>'yearly', 'interval'=>1) |
|
protected
integer
|
$start | 0 |
|
protected
string
|
$freq | '' |
|
protected
mixed
|
$excluded |
|
|
protected
mixed
|
$added |
|
|
protected
mixed
|
$cache |
|