Code Duplication    Length = 31-31 lines in 2 locations

includes/api/class-give-api.php 2 locations

@@ 806-836 (lines=31) @@
803
804
					break;
805
806
				case 'this_quarter' :
807
					$month_now = date( 'n', $current_time );
808
809
					$dates['day'] = null;
810
811
					if ( $month_now <= 3 ) {
812
813
						$dates['m_start'] = 1;
814
						$dates['m_end']   = 3;
815
						$dates['year']    = date( 'Y', $current_time );
816
817
					} elseif ( $month_now <= 6 ) {
818
819
						$dates['m_start'] = 4;
820
						$dates['m_end']   = 6;
821
						$dates['year']    = date( 'Y', $current_time );
822
823
					} elseif ( $month_now <= 9 ) {
824
825
						$dates['m_start'] = 7;
826
						$dates['m_end']   = 9;
827
						$dates['year']    = date( 'Y', $current_time );
828
829
					} else {
830
831
						$dates['m_start'] = 10;
832
						$dates['m_end']   = 12;
833
						$dates['year']    = date( 'Y', $current_time );
834
835
					}
836
					break;
837
838
				case 'last_quarter' :
839
					$month_now = date( 'n', $current_time );
@@ 838-868 (lines=31) @@
835
					}
836
					break;
837
838
				case 'last_quarter' :
839
					$month_now = date( 'n', $current_time );
840
841
					$dates['day'] = null;
842
843
					if ( $month_now <= 3 ) {
844
845
						$dates['m_start'] = 10;
846
						$dates['m_end']   = 12;
847
						$dates['year']    = date( 'Y', $current_time ) - 1; // Previous year
848
849
					} elseif ( $month_now <= 6 ) {
850
851
						$dates['m_start'] = 1;
852
						$dates['m_end']   = 3;
853
						$dates['year']    = date( 'Y', $current_time );
854
855
					} elseif ( $month_now <= 9 ) {
856
857
						$dates['m_start'] = 4;
858
						$dates['m_end']   = 6;
859
						$dates['year']    = date( 'Y', $current_time );
860
861
					} else {
862
863
						$dates['m_start'] = 7;
864
						$dates['m_end']   = 9;
865
						$dates['year']    = date( 'Y', $current_time );
866
867
					}
868
					break;
869
870
				case 'this_year' :
871
					$dates['day']     = null;