Code Duplication    Length = 20-22 lines in 2 locations

programs/utilit/RRule.php 2 locations

@@ 924-945 (lines=22) @@
921
	    else if ( $this->_part['FREQ'] == "WEEKLY" ) {
922
	      dbg_error_log( "RRule", " GetNext: Calculating more dates for WEEKLY rule" );
923
	      $limit = 200;
924
	      do {
925
	        $limit--;
926
	        if ( $this->_started ) {
927
	          $next->AddDays($this->_part['INTERVAL'] * 7);
928
	        }
929
	        else {
930
	          $this->_started = true;
931
	        }
932
	
933
	        if ( isset($this->_part['BYDAY']) ) {
934
	          $days = $next->GetWeekByDay($this->_part['BYDAY'], false );
935
	        }
936
	        else
937
	          $days[$next->_dd] = $next->_dd;
938
	
939
	        if ( isset($this->_part['BYSETPOS']) ) {
940
	          $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days);
941
	        }
942
	
943
	        $days = $this->WithinScope( $next, $days);
944
	      }
945
	      while( $limit && count($days) < 1 && ! $this->_finished );
946
	
947
	      dbg_error_log( "RRule", " GetNext: Found %d days for WEEKLY rule", count($days) );
948
	    }
@@ 952-971 (lines=20) @@
949
	    else if ( $this->_part['FREQ'] == "DAILY" ) {
950
	      dbg_error_log( "RRule", " GetNext: Calculating more dates for DAILY rule" );
951
	      $limit = 100;
952
	      do {
953
	        $limit--;
954
	        if ( $this->_started ) {
955
	          $next->AddDays($this->_part['INTERVAL']);
956
	        }
957
	
958
	        if ( isset($this->_part['BYDAY']) ) {
959
	          $days = $next->GetWeekByDay($this->_part['BYDAY'], $this->_started );
960
	        }
961
	        else
962
	          $days[$next->_dd] = $next->_dd;
963
	
964
	        if ( isset($this->_part['BYSETPOS']) ) {
965
	          $days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days);
966
	        }
967
	
968
	        $days = $this->WithinScope( $next, $days);
969
	        $this->_started = true;
970
	      }
971
	      while( $limit && count($days) < 1 && ! $this->_finished );
972
	
973
	      dbg_error_log( "RRule", " GetNext: Found %d days for DAILY rule", count($days) );
974
	    }