Code Duplication    Length = 26-27 lines in 3 locations

mod/wet4/start.php 3 locations

@@ 694-720 (lines=27) @@
691
	$entContext = $entity->getType();
692
693
	//check if entity is an object or group
694
	if ($entContext == 'object') {
695
696
		//find subtype
697
		$contentType = $entity->getSubtype();
698
		//convert subtype into plain language
699
		$entContext = proper_subtypes($contentType);//$entity->getSubtype();
700
701
		//check to see if entity is one f the entities with a title
702
		if (!in_array($entity->getSubtype(), array('comment', 'discussion_reply', 'thewire'))) {
703
			if ($entity->title3) {
704
				$entName = gc_explode_translation($entity->title3, $lang);
705
			} else {
706
				$entName = $entity->title;
707
			}
708
		} else { //if not get owner instead of name
709
710
			$entName = $entity->getOwnerEntity()->name;
711
		}
712
	} elseif ($entContext == 'group') {
713
		$contentType = 'group';
714
		$entContext = elgg_echo('group');
715
		if ($entity->title3) {
716
			$entName = gc_explode_translation($entity->title3, $lang);
717
		} else {
718
			$entName = $entity->name;
719
		}
720
	}
721
722
	if ($entity->canAnnotate(0, 'likes')) {
723
		$hasLiked = \Elgg\Likes\DataService::instance()->currentUserLikesEntity($entity->guid);
@@ 878-904 (lines=27) @@
875
	$entContext = $entity->getType();
876
877
	//check if entity is an object or group
878
	if ($entContext == 'object') {
879
880
		//find subtype
881
		$contentType = $entity->getSubtype();
882
		//convert subtype into plain language
883
		$entContext = proper_subtypes($contentType);
884
885
		//check to see if entity is one f the entities with a title
886
		if (!in_array($entity->getSubtype(), array('comment', 'discussion_reply', 'thewire', 'answer'))) {
887
			if ($entity->title3) {
888
				$entName = gc_explode_translation($entity->title3, $lang);
889
			} else {
890
				$entName = $entity->title;
891
			}
892
		} else { //if not get owner instead of name
893
894
			$entName = $entity->getOwnerEntity()->name;
895
		}
896
	} elseif ($entContext == 'group') {
897
		$contentType = 'group';
898
		$entContext = elgg_echo('group');
899
		if ($entity->title3) {
900
			$entName = gc_explode_translation($entity->title3, $lang);
901
		} else {
902
			$entName = $entity->name;
903
		}
904
	}
905
906
	//pass type and entiey/owner name to function to return array of text
907
	$hiddenText = generate_hidden_text($contentType, $entName);
@@ 1228-1253 (lines=26) @@
1225
1226
		$entContext = $object->getType();
1227
		//check if entity is an object or group
1228
		if ($entContext == 'object') {
1229
1230
			//find subtype
1231
			$contentType = $object->getSubtype();
1232
			//convert subtype into plain language
1233
			$entContext = proper_subtypes($contentType);
1234
1235
			//check to see if entity is one f the entities with a title
1236
			if (!in_array($object->getSubtype(), array('comment', 'discussion_reply', 'thewire', 'answer'))) {
1237
				if ($object->title3) {
1238
					$entName = gc_explode_translation($object->title3, $lang);
1239
				} else {
1240
					$entName = $object->title;
1241
				}
1242
			} else { //if not get owner instead of name
1243
				$entName = $object->getOwnerEntity()->name;
1244
			}
1245
		} elseif ($entContext == 'group') {
1246
			$contentType = 'group';
1247
			$entContext = elgg_echo('group');
1248
			if ($object->title3) {
1249
				$entName = gc_explode_translation($object->title3, $lang);
1250
			} else {
1251
				$entName = $object->name;
1252
			}
1253
		}
1254
1255
		//pass type and entiey/owner name to function to return array of text
1256
		$hiddenText = generate_hidden_text($contentType, $entName);