Code Duplication    Length = 29-29 lines in 2 locations

includes/admin/reports/graphing.php 1 location

@@ 642-670 (lines=29) @@
639
			$dates['year']    = date( 'Y', $current_time );
640
			break;
641
642
		case 'yesterday' :
643
644
			$year  = date( 'Y', $current_time );
645
			$month = date( 'n', $current_time );
646
			$day   = date( 'd', $current_time );
647
648
			if ( $month == 1 && $day == 1 ) {
649
650
				$year -= 1;
651
				$month = 12;
652
				$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
653
654
			} elseif ( $month > 1 && $day == 1 ) {
655
656
				$month -= 1;
657
				$day = cal_days_in_month( CAL_GREGORIAN, $month, $year );
658
659
			} else {
660
661
				$day -= 1;
662
663
			}
664
665
			$dates['day']      = $day;
666
			$dates['m_start']  = $month;
667
			$dates['m_end']    = $month;
668
			$dates['year']     = $year;
669
			$dates['year_end'] = $year;
670
			break;
671
672
		case 'this_week' :
673
			$dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1;

includes/api/class-give-api.php 1 location

@@ 748-776 (lines=29) @@
745
					$dates['year']    = date( 'Y', $current_time );
746
					break;
747
748
				case 'yesterday' :
749
750
					$year  = date( 'Y', $current_time );
751
					$month = date( 'n', $current_time );
752
					$day   = date( 'd', $current_time );
753
754
					if ( $month == 1 && $day == 1 ) {
755
756
						$year  -= 1;
757
						$month = 12;
758
						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
759
760
					} elseif ( $month > 1 && $day == 1 ) {
761
762
						$month -= 1;
763
						$day   = cal_days_in_month( CAL_GREGORIAN, $month, $year );
764
765
					} else {
766
767
						$day -= 1;
768
769
					}
770
771
					$dates['day']     = $day;
772
					$dates['m_start'] = $month;
773
					$dates['m_end']   = $month;
774
					$dates['year']    = $year;
775
776
					break;
777
778
				case 'this_quarter' :
779
					$month_now = date( 'n', $current_time );