Code Duplication    Length = 5-7 lines in 3 locations

main/inc/lib/icalcreator/iCalcreator.class.php 3 locations

@@ 2979-2985 (lines=7) @@
2976
                    $formatted = $this->_format_date_time( $rdatePart[0]); // PERIOD part 1
2977
                    if( $utctime || !empty( $theRdate['params']['TZID'] ))
2978
                        $formatted = str_replace( 'Z', '', $formatted);
2979
                    if( 0 < $rpix ) {
2980
                        if( !empty( $rdatePart[0]['tz'] ) && $this->_isOffset( $rdatePart[0]['tz'] )) {
2981
                            if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
2982
                        }
2983
                        else
2984
                            $formatted = str_replace( 'Z', '', $formatted );
2985
                    }
2986
                    $contentPart .= $formatted;
2987
                    $contentPart .= '/';
2988
                    $cnt2 = count( $rdatePart[1]);
@@ 3006-3010 (lines=5) @@
3003
                        $formatted = $this->_format_date_time( $rdatePart[1] ); // PERIOD part 2
3004
                        if( $utctime || !empty( $theRdate['params']['TZID'] ))
3005
                            $formatted = str_replace( 'Z', '', $formatted);
3006
                        if( !empty( $rdatePart[0]['tz'] ) && $this->_isOffset( $rdatePart[0]['tz'] )) {
3007
                            if( 'Z' != substr( $formatted, -1 )) $formatted .= 'Z';
3008
                        }
3009
                        else
3010
                            $formatted = str_replace( 'Z', '', $formatted );
3011
                        $contentPart .= $formatted;
3012
                    }
3013
                    else {                                  // period=  -> dur-time
@@ 3024-3029 (lines=6) @@
3021
                    if( $utctime || !empty( $theRdate['params']['TZID'] ))
3022
                        $formatted = str_replace( 'Z', '', $formatted);
3023
                    if( !$utctime && ( 0 < $rpix )) {
3024
                        if( !empty( $theRdate['value'][0]['tz'] ) && $this->_isOffset( $theRdate['value'][0]['tz'] )) {
3025
                            if( 'Z' != substr( $formatted, -1 ))
3026
                                $formatted .= 'Z';
3027
                        }
3028
                        else
3029
                            $formatted = str_replace( 'Z', '', $formatted );
3030
                    }
3031
                    $contentPart .= $formatted;
3032
                }