Code Duplication    Length = 7-7 lines in 2 locations

programs/caldav.class.php 2 locations

@@ 840-846 (lines=7) @@
837
					$date_period->fromIcal($eventData);
838
					
839
					$date_period->setDates(BAB_DateTime::fromICal($dtStart->_text), BAB_DateTime::fromICal($dtEnd->_text));
840
					if (isset($collection)) {
841
						$collection->addPeriod($date_period);
842
						$relations = $date_period->getRelations('PARENT');
843
						if (count($relations) === 0) {
844
							$date_period->addRelation('PARENT', $collection->getCalendar());
845
						}
846
					}
847
					$periods[$date_period->getProperty('DTSTART')] = $date_period;
848
				}
849
@@ 853-859 (lines=7) @@
850
851
			} else {
852
853
				if (isset($collection)) {
854
					$collection->addPeriod($period);
855
					$relations = $period->getRelations('PARENT');
856
					if (count($relations) === 0) {
857
						$period->addRelation('PARENT', $collection->getCalendar());
858
					}
859
				}
860
				if (!$expandRecurrence || ($period->getProperty('DTSTART') < $expandEnd && $period->getProperty('DTEND') > $expandStart) ) {
861
					$recurrenceId = $period->getProperty('RECURRENCE-ID');
862
					if ($recurrenceId !== '') {