Code Duplication    Length = 31-32 lines in 2 locations

mod/gc_mobile_api/models/group.php 1 location

@@ 246-276 (lines=31) @@
243
		login($user_entity);
244
245
	$filter_data = json_decode($filters);
246
	if( !empty($filter_data) ){
247
		$params = array(
248
	        'type' => 'object',
249
	        'subtype' => 'groupforumtopic',
250
			'limit' => $limit,
251
	        'offset' => $offset
252
		);
253
254
		if( $filter_data->mine ){
255
			$params['owner_guid'] = $user_entity->guid;
256
		}
257
258
		if( $filter_data->name ){
259
			$db_prefix = elgg_get_config('dbprefix');
260
        	$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
261
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
262
        }
263
264
        if( $filter_data->mine ){
265
	    	$all_discussions = elgg_list_entities_from_relationship($params);
266
        } else {
267
	    	$all_discussions = elgg_list_entities_from_metadata($params);
268
        }
269
	} else {
270
		$all_discussions = elgg_list_entities(array(
271
	        'type' => 'object',
272
	        'subtype' => 'groupforumtopic',
273
	        'limit' => $limit,
274
	        'offset' => $offset
275
	    ));
276
	}
277
	
278
	$discussions = json_decode($all_discussions);
279

mod/gc_mobile_api/models/opportunity.php 1 location

@@ 87-118 (lines=32) @@
84
		login($user_entity);
85
86
	$filter_data = json_decode($filters);
87
	if( !empty($filter_data) ){
88
		$params = array(
89
	        'type' => 'object',
90
	        'subtype' => 'mission',
91
			'limit' => $limit,
92
	        'offset' => $offset
93
		);
94
95
		if( $filter_data->type ){
96
			$params['metadata_name'] = 'job_type';
97
	        $params['metadata_value'] = $filter_data->type;
98
		}
99
100
		if( $filter_data->name ){
101
			$db_prefix = elgg_get_config('dbprefix');
102
			$params['joins'] = array("JOIN {$db_prefix}objects_entity oe ON e.guid = oe.guid");
103
			$params['wheres'] = array("(oe.title LIKE '%" . $filter_data->name . "%' OR oe.description LIKE '%" . $filter_data->name . "%')");
104
        }
105
106
        if( $filter_data->mine ){
107
	    	$all_opportunities = elgg_list_entities_from_relationship($params);
108
        } else {
109
	    	$all_opportunities = elgg_list_entities_from_metadata($params);
110
        }
111
	} else {
112
		$all_opportunities = elgg_list_entities(array(
113
	        'type' => 'object',
114
	        'subtype' => 'mission',
115
	        'limit' => $limit,
116
	        'offset' => $offset
117
	    ));
118
	}
119
	
120
	$opportunities = json_decode($all_opportunities);
121