Code Duplication    Length = 7-7 lines in 2 locations

mod/gc_mobile_api/models/event.php 2 locations

@@ 139-145 (lines=7) @@
136
		'order_by_metadata' => array(array('name' => 'start_date', 'direction' => 'DESC', 'as' => 'integer'))
137
	);
138
139
	if ($from) {
140
		$params['metadata_name_value_pairs'][] = array(
141
			'name' => 'start_date',
142
			'value' => strtotime($from),
143
			'operand' => '>='
144
		);
145
	}
146
	if ($to) {
147
		$params['metadata_name_value_pairs'][] = array(
148
			'name' => 'end_date',
@@ 146-152 (lines=7) @@
143
			'operand' => '>='
144
		);
145
	}
146
	if ($to) {
147
		$params['metadata_name_value_pairs'][] = array(
148
			'name' => 'end_date',
149
			'value' => strtotime($to),
150
			'operand' => '<='
151
		);
152
	}
153
154
	$all_events = elgg_list_entities_from_metadata($params);
155
	$events = json_decode($all_events);