Code Duplication    Length = 17-19 lines in 2 locations

mod/gc_mobile_api/models/discussion.php 1 location

@@ 179-197 (lines=19) @@
176
177
	$discussions = json_decode($all_discussions);
178
179
	foreach ($discussions as $discussion) {
180
		$discussion->name = gc_explode_translation($discussion->name, $lang);
181
182
		$likes = elgg_get_annotations(array(
183
			'guid' => $discussion->guid,
184
			'annotation_name' => 'likes'
185
		));
186
		$discussion->likes = count($likes);
187
188
		$liked = elgg_get_annotations(array(
189
			'guid' => $discussion->guid,
190
			'annotation_owner_guid' => $user_entity->guid,
191
			'annotation_name' => 'likes'
192
		));
193
		$discussion->liked = count($liked) > 0;
194
195
		$discussion->userDetails = get_user_block($discussion->owner_guid, $lang);
196
		$discussion->description = gc_explode_translation($discussion->description, $lang);
197
	}
198
199
	return $discussions;
200
}

mod/gc_mobile_api/models/group.php 1 location

@@ 606-622 (lines=17) @@
603
	));
604
605
	$discussions = json_decode($discussions);
606
	foreach ($discussions as $discussion) {
607
		$likes = elgg_get_annotations(array(
608
			'guid' => $discussion->guid,
609
			'annotation_name' => 'likes'
610
		));
611
		$discussion->likes = count($likes);
612
613
		$liked = elgg_get_annotations(array(
614
			'guid' => $discussion->guid,
615
			'annotation_owner_guid' => $user_entity->guid,
616
			'annotation_name' => 'likes'
617
		));
618
		$discussion->liked = count($liked) > 0;
619
		$discussion->userDetails = get_user_block($discussion->owner_guid, $lang);
620
		$discussion->title = gc_explode_translation($discussion->title, $lang);
621
		$discussion->description = gc_explode_translation($discussion->description, $lang);
622
	}
623
624
	return $discussions;
625
}