From 301173e7dd56d3cc1f921131fb88ada31139ba9e Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 8 Jun 2009 18:17:58 +0200 Subject: [PATCH] Add reset(). --- framework/Date/lib/Horde/Date/Recurrence.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/framework/Date/lib/Horde/Date/Recurrence.php b/framework/Date/lib/Horde/Date/Recurrence.php index 5917e95f6..205e5c13e 100644 --- a/framework/Date/lib/Horde/Date/Recurrence.php +++ b/framework/Date/lib/Horde/Date/Recurrence.php @@ -121,6 +121,20 @@ class Horde_Date_Recurrence } /** + * Resets the class properties. + */ + public function reset() + { + $this->recurEnd = null; + $this->recurCount = null; + $this->recurType = self::RECUR_NONE; + $this->recurInterval = 1; + $this->recurData = null; + $this->exceptions = array(); + $this->completions = array(); + } + + /** * Checks if this event recurs on a given day of the week. * * @param integer $dayMask A mask consisting of Horde_Date::MASK_* @@ -801,6 +815,8 @@ class Horde_Date_Recurrence */ public function fromRRule10($rrule) { + $this->reset(); + if (!$rrule) { return; } @@ -971,6 +987,8 @@ class Horde_Date_Recurrence */ public function fromRRule20($rrule) { + $this->reset(); + // Parse the recurrence rule into keys and values. $rdata = array(); $parts = explode(';', $rrule); @@ -1154,6 +1172,8 @@ class Horde_Date_Recurrence */ public function fromHash($hash) { + $this->reset(); + if (!isset($hash['interval']) || !isset($hash['interval']) || !isset($hash['range-type'])) { $this->setRecurType(self::RECUR_NONE); -- 2.11.0