Code Duplication    Length = 7-7 lines in 2 locations

programs/caldav.class.php 2 locations

@@ 868-874 (lines=7) @@
865
					$date_period->fromIcal($eventData);
866
					
867
					$date_period->setDates(BAB_DateTime::fromICal($dtStart->_text), BAB_DateTime::fromICal($dtEnd->_text));
868
					if (isset($collection)) {
869
						$collection->addPeriod($date_period);
870
						$relations = $date_period->getRelations('PARENT');
871
						if (count($relations) === 0) {
872
							$date_period->addRelation('PARENT', $collection->getCalendar());
873
						}
874
					}
875
					$periods[$date_period->getProperty('DTSTART')] = $date_period;
876
				}
877
@@ 881-887 (lines=7) @@
878
879
			} else {
880
881
				if (isset($collection)) {
882
					$collection->addPeriod($period);
883
					$relations = $period->getRelations('PARENT');
884
					if (count($relations) === 0) {
885
						$period->addRelation('PARENT', $collection->getCalendar());
886
					}
887
				}
888
				if (!$expandRecurrence || ($period->getProperty('DTSTART') < $expandEnd && $period->getProperty('DTEND') > $expandStart) ) {
889
					$recurrenceId = $period->getProperty('RECURRENCE-ID');
890
					if ($recurrenceId !== '') {