Code Duplication    Length = 5-5 lines in 3 locations

core/db_models/EEM_Event.model.php 3 locations

@@ 488-492 (lines=5) @@
485
		//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.
486
		$where_params['status'] = 'publish';
487
		//if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions
488
		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
489
			$where_params['Datetime.DTT_EVT_start******'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
490
		} else {
491
			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
492
		}
493
494
		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
495
			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
@@ 494-498 (lines=5) @@
491
			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
492
		}
493
494
		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
495
			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
496
		} else {
497
			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
498
		}
499
		$query_params[0] = $where_params;
500
		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
501
		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
@@ 532-536 (lines=5) @@
529
		//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.
530
		$where_params['status'] = 'publish';
531
		//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
532
		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
533
			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
534
		} else {
535
			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
536
		}
537
		$query_params[0] = $where_params;
538
		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
539
		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );