Code Duplication    Length = 36-38 lines in 2 locations

mod/cp_notifications/lib/functions.php 2 locations

@@ 216-251 (lines=36) @@
213
214
	switch ($subtype) {
215
216
		case 'single_zip_file_upload':
217
			$file_entity = get_entity($entity[0]);
218
			$container = $file_entity->getContainerEntity();
219
			$file_count = 0;
220
221
			$display_files = "<p><ol>";
222
			foreach ($entity as $file_num => $file) {
223
				$file_count++;
224
				$file_entity = get_entity($file);
225
				$display_files .= "<li><a href='{$file_entity->getURL()}?utm_source=notification_digest&utm_medium=email'>{$file_entity->title}</a></li>";
226
			}
227
			$display_files .= "</ol></p>";
228
			$content_array = array(
229
				'file_count'			=> $file_count,
230
				'content_title' 		=> $display_files,
231
				'subtype' 				=> 'file_upload',
232
				'content_author_name' 	=> $file_entity->getOwnerEntity()->name,
233
				'content_author_url' 	=> $file_entity->getOwnerEntity()->getURL()
234
			);
235
236
			if ($container instanceof ElggUser) {
237
				$entity_guid = $file_entity->getGUID();
238
				$user_guid = $send_to->getGUID();
239
				$entry_type = 'personal';
240
				$group_name = NULL;
241
				$action_type = 'new_post';
242
				$notification_entry = json_encode($content_array);
243
			} else {
244
				$entity_guid = $file_entity->getGUID();
245
				$user_guid = $send_to->getGUID();
246
				$entry_type = 'group';
247
				$group_name = $container->name;
248
				$action_type = 'new_post';
249
				$notification_entry = json_encode($content_array);
250
			}
251
			break;
252
253
		case 'multi_file_upload':
254
@@ 253-290 (lines=38) @@
250
			}
251
			break;
252
253
		case 'multi_file_upload':
254
255
			$file_entity = get_entity($entity[0]);
256
			$container = $file_entity->getContainerEntity();
257
			$file_count = 0;
258
259
			$display_files = "<p><ol>";
260
			foreach ($entity as $file_num => $file) {
261
				$file_count++;
262
				$file_entity = get_entity($file);
263
				$display_files .= "<li><a href='{$file_entity->getURL()}?utm_source=notification_digest&utm_medium=email'>{$file_entity->title}</a></li>";
264
			}
265
266
			$display_files .= "</ol></p>";
267
			$content_array = array(
268
				'file_count'			=> $file_count,
269
				'content_title' 		=> $display_files,
270
				'subtype' 				=> 'file_upload',
271
				'content_author_name' 	=> $file_entity->getOwnerEntity()->name,
272
				'content_author_url' 	=> $file_entity->getOwnerEntity()->getURL()
273
			);
274
275
			if ($container instanceof ElggUser) {
276
				$entity_guid = $file_entity->getGUID();
277
				$user_guid = $send_to->getGUID();
278
				$entry_type = 'personal';
279
				$group_name = NULL;
280
				$action_type = 'new_post';
281
				$notification_entry = json_encode($content_array);
282
			} else {
283
				$entity_guid = $file_entity->getGUID();
284
				$user_guid = $send_to->getGUID();
285
				$entry_type = 'group';
286
				$group_name = $container->name;
287
				$action_type = 'new_post';
288
				$notification_entry = json_encode($content_array);
289
			}
290
291
			break;
292
293
		case 'thewire':