Code Duplication    Length = 4-6 lines in 3 locations

_inc/lib/icalendar-reader.php 3 locations

@@ 136-140 (lines=5) @@
133
		foreach ( $events as $event ) {
134
135
			$date_from_ics = strtotime( $event['DTSTART'] );
136
			if ( isset( $event['DTEND'] ) ) {
137
				$duration = strtotime( $event['DTEND'] ) - strtotime( $event['DTSTART'] );
138
			} else {
139
				$duration = 0;
140
			}
141
142
			if ( isset( $event['RRULE'] ) && $this->timezone->getName() && 8 != strlen( $event['DTSTART'] ) ) {
143
				try {
@@ 436-439 (lines=4) @@
433
						if ( 8 == strlen( $event['DTSTART'] ) ) {
434
							$event['DTSTART'] = date( 'Ymd', $next_start_timestamp );
435
							$event['DTEND'] = date( 'Ymd', strtotime( $event['DTSTART'] ) + $duration );
436
						} else {
437
							$event['DTSTART'] = date( 'Ymd\THis', $next_start_timestamp );
438
							$event['DTEND'] = date( 'Ymd\THis', strtotime( $event['DTSTART'] ) + $duration );
439
						}
440
441
						// Move recurring event date forward
442
						$recurring_event_date_start = $event['DTSTART'];
@@ 448-453 (lines=6) @@
445
446
				}
447
448
			} else {
449
				// Process normal events
450
				if ( strtotime( isset( $event['DTEND'] ) ? $event['DTEND'] : $event['DTSTART'] ) >= $current ) {
451
					$upcoming[] = $event;
452
				}
453
			}
454
		}
455
		return $upcoming;
456
	}