Code Duplication    Length = 55-56 lines in 2 locations

includes/class-give-stats.php 2 locations

@@ 300-354 (lines=55) @@
297
298
					break;
299
300
				case 'this_quarter' :
301
302
					$month_now = date( 'n', current_time( 'timestamp' ) );
303
304
					if ( $month_now <= 3 ) {
305
306
						if ( ! $end_date ) {
307
							$month = 1;
308
						} else {
309
							$month  = 3;
310
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
311
							$hour   = 23;
312
							$minute = 59;
313
							$second = 59;
314
						}
315
316
					} else if ( $month_now <= 6 ) {
317
318
						if ( ! $end_date ) {
319
							$month = 4;
320
						} else {
321
							$month  = 6;
322
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
323
							$hour   = 23;
324
							$minute = 59;
325
							$second = 59;
326
						}
327
328
					} else if ( $month_now <= 9 ) {
329
330
						if ( ! $end_date ) {
331
							$month = 7;
332
						} else {
333
							$month  = 9;
334
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
335
							$hour   = 23;
336
							$minute = 59;
337
							$second = 59;
338
						}
339
340
					} else {
341
342
						if ( ! $end_date ) {
343
							$month = 10;
344
						} else {
345
							$month  = 12;
346
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
347
							$hour   = 23;
348
							$minute = 59;
349
							$second = 59;
350
						}
351
352
					}
353
354
					break;
355
356
				case 'last_quarter' :
357
@@ 356-411 (lines=56) @@
353
354
					break;
355
356
				case 'last_quarter' :
357
358
					$month_now = date( 'n', current_time( 'timestamp' ) );
359
360
					if ( $month_now <= 3 ) {
361
362
						if ( ! $end_date ) {
363
							$month = 10;
364
						} else {
365
							$year -= 1;
366
							$month  = 12;
367
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
368
							$hour   = 23;
369
							$minute = 59;
370
							$second = 59;
371
						}
372
373
					} else if ( $month_now <= 6 ) {
374
375
						if ( ! $end_date ) {
376
							$month = 1;
377
						} else {
378
							$month  = 3;
379
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
380
							$hour   = 23;
381
							$minute = 59;
382
							$second = 59;
383
						}
384
385
					} else if ( $month_now <= 9 ) {
386
387
						if ( ! $end_date ) {
388
							$month = 4;
389
						} else {
390
							$month  = 6;
391
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
392
							$hour   = 23;
393
							$minute = 59;
394
							$second = 59;
395
						}
396
397
					} else {
398
399
						if ( ! $end_date ) {
400
							$month = 7;
401
						} else {
402
							$month  = 9;
403
							$day    = cal_days_in_month( CAL_GREGORIAN, $month, $year );
404
							$hour   = 23;
405
							$minute = 59;
406
							$second = 59;
407
						}
408
409
					}
410
411
					break;
412
413
				case 'this_year' :
414