Code Duplication    Length = 5-5 lines in 3 locations

core/db_models/EEM_Event.model.php 3 locations

@@ 490-494 (lines=5) @@
487
		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
488
		$where_params['status'] = 'publish';
489
		//if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions
490
		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
491
			$where_params['Datetime.DTT_EVT_start******'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
492
		} else {
493
			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
494
		}
495
496
		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
497
			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
@@ 496-500 (lines=5) @@
493
			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
494
		}
495
496
		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
497
			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
498
		} else {
499
			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
500
		}
501
		$query_params[0] = $where_params;
502
		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY"
503
		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
@@ 534-538 (lines=5) @@
531
		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
532
		$where_params['status'] = 'publish';
533
		//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
534
		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
535
			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
536
		} else {
537
			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
538
		}
539
		$query_params[0] = $where_params;
540
		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY"
541
		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );