Code Duplication    Length = 28-28 lines in 2 locations

mod/gc_mobile_api/models/blog.php 2 locations

@@ 149-176 (lines=28) @@
146
147
	$blog_posts = json_decode($all_blog_posts);
148
149
	foreach ($blog_posts as $blog_post) {
150
		$blog_post->title = gc_explode_translation($blog_post->title, $lang);
151
		$blog_post->description = gc_explode_translation($blog_post->description, $lang);
152
153
		$likes = elgg_get_annotations(array(
154
			'guid' => $blog_post->guid,
155
			'annotation_name' => 'likes'
156
		));
157
		$blog_post->likes = count($likes);
158
159
		$liked = elgg_get_annotations(array(
160
			'guid' => $blog_post->guid,
161
			'annotation_owner_guid' => $user_entity->guid,
162
			'annotation_name' => 'likes'
163
		));
164
		$blog_post->liked = count($liked) > 0;
165
166
		$blog_post->comments = get_entity_comments($blog_post->guid);
167
168
		$blog_post->userDetails = get_user_block($blog_post->owner_guid, $lang);
169
170
		$group = get_entity($blog_post->container_guid);
171
		$blog_post->group = gc_explode_translation($group->name, $lang);
172
173
		if (is_callable(array($group, 'getURL'))) {
174
			$blog_post->groupURL = $group->getURL();
175
		}
176
	}
177
178
	return $blog_posts;
179
}
@@ 216-243 (lines=28) @@
213
214
	$blog_posts = json_decode($all_blog_posts);
215
216
	foreach ($blog_posts as $blog_post) {
217
		$blog_post->title = gc_explode_translation($blog_post->title, $lang);
218
		$blog_post->description = gc_explode_translation($blog_post->description, $lang);
219
220
		$likes = elgg_get_annotations(array(
221
			'guid' => $blog_post->guid,
222
			'annotation_name' => 'likes'
223
		));
224
		$blog_post->likes = count($likes);
225
226
		$liked = elgg_get_annotations(array(
227
			'guid' => $blog_post->guid,
228
			'annotation_owner_guid' => $user_entity->guid,
229
			'annotation_name' => 'likes'
230
		));
231
		$blog_post->liked = count($liked) > 0;
232
233
		$blog_post->comments = get_entity_comments($blog_post->guid);
234
235
		$blog_post->userDetails = get_user_block($blog_post->owner_guid, $lang);
236
237
		$group = get_entity($blog_post->container_guid);
238
		$blog_post->group = gc_explode_translation($group->name, $lang);
239
240
		if (is_callable(array($group, 'getURL'))) {
241
			$blog_post->groupURL = $group->getURL();
242
		}
243
	}
244
245
	return $blog_posts;
246
}