Code Duplication    Length = 20-21 lines in 2 locations

mod/cp_notifications/lib/functions.php 2 locations

@@ 333-352 (lines=20) @@
330
		case 'discussion_reply':
331
332
333
			if ($entity->getContainerEntity() instanceof ElggGroup) {
334
335
				// string that will contain the url and the (json) string name of group
336
				$group_html = json_encode(array($entity->getContainerEntity()->getURL(), $entity->getContainerEntity()->name));
337
				$entity_guid = $entity->guid;
338
				$user_guid = $send_to->getGUID();
339
				$entry_type = 'group';
340
				$group_name = $group_html;
341
				$action_type = 'response';
342
				$notification_entry = json_encode($content_array);
343
344
			} else { 
345
346
				$entity_guid = $entity->guid;
347
				$user_guid = $send_to->getGUID();
348
				$entry_type = 'personal';
349
				$group_name = NULL;
350
				$action_type = 'response';
351
				$notification_entry = json_encode($content_array);
352
			}
353
			break;
354
355
		case 'cp_friend_request':
@@ 548-568 (lines=21) @@
545
546
			$entity = get_entity($entity->guid);
547
548
			if ($entity->getContainerEntity() instanceof ElggGroup) {
549
			
550
				$group_title = $entity->getContainerEntity()->name;
551
				$group_html = json_encode(array($entity->getContainerEntity()->getURL(), $group_title));
552
553
				$entity_guid = $entity->guid;
554
				$user_guid = $send_to->getGUID();
555
				$entry_type = 'group';
556
				$group_name = $group_html;//"<a href='{$entity->getContainerEntity()->getURL()}?utm_source=notification_digest&utm_medium=email'>{$group_title}</a>";
557
				$action_type = 'new_post';
558
				$notification_entry = json_encode($content_array);
559
560
			}
561
			else {
562
				$entity_guid = $entity->guid;
563
				$user_guid = $send_to->getGUID();
564
				$entry_type = 'personal';
565
				$group_name = NULL;
566
				$action_type = 'new_post';
567
				$notification_entry = json_encode($content_array);
568
			}
569
570
			break;
571
	}