Code Duplication    Length = 26-27 lines in 3 locations

mod/wet4/start.php 3 locations

@@ 693-719 (lines=27) @@
690
	$entContext = $entity->getType();
691
692
	//check if entity is an object or group
693
	if ($entContext == 'object') {
694
695
		//find subtype
696
		$contentType = $entity->getSubtype();
697
		//convert subtype into plain language
698
		$entContext = proper_subtypes($contentType);//$entity->getSubtype();
699
700
		//check to see if entity is one f the entities with a title
701
		if (!in_array($entity->getSubtype(), array('comment', 'discussion_reply', 'thewire'))) {
702
			if ($entity->title3) {
703
				$entName = gc_explode_translation($entity->title3, $lang);
704
			} else {
705
				$entName = $entity->title;
706
			}
707
		} else { //if not get owner instead of name
708
709
			$entName = $entity->getOwnerEntity()->name;
710
		}
711
	} elseif ($entContext == 'group') {
712
		$contentType = 'group';
713
		$entContext = elgg_echo('group');
714
		if ($entity->title3) {
715
			$entName = gc_explode_translation($entity->title3, $lang);
716
		} else {
717
			$entName = $entity->name;
718
		}
719
	}
720
721
	if ($entity->canAnnotate(0, 'likes')) {
722
		$hasLiked = \Elgg\Likes\DataService::instance()->currentUserLikesEntity($entity->guid);
@@ 877-903 (lines=27) @@
874
	$entContext = $entity->getType();
875
876
	//check if entity is an object or group
877
	if ($entContext == 'object') {
878
879
		//find subtype
880
		$contentType = $entity->getSubtype();
881
		//convert subtype into plain language
882
		$entContext = proper_subtypes($contentType);
883
884
		//check to see if entity is one f the entities with a title
885
		if (!in_array($entity->getSubtype(), array('comment', 'discussion_reply', 'thewire', 'answer'))) {
886
			if ($entity->title3) {
887
				$entName = gc_explode_translation($entity->title3, $lang);
888
			} else {
889
				$entName = $entity->title;
890
			}
891
		} else { //if not get owner instead of name
892
893
			$entName = $entity->getOwnerEntity()->name;
894
		}
895
	} elseif ($entContext == 'group') {
896
		$contentType = 'group';
897
		$entContext = elgg_echo('group');
898
		if ($entity->title3) {
899
			$entName = gc_explode_translation($entity->title3, $lang);
900
		} else {
901
			$entName = $entity->name;
902
		}
903
	}
904
905
	//pass type and entiey/owner name to function to return array of text
906
	$hiddenText = generate_hidden_text($contentType, $entName);
@@ 1188-1213 (lines=26) @@
1185
1186
		$entContext = $object->getType();
1187
		//check if entity is an object or group
1188
		if ($entContext == 'object') {
1189
1190
			//find subtype
1191
			$contentType = $object->getSubtype();
1192
			//convert subtype into plain language
1193
			$entContext = proper_subtypes($contentType);
1194
1195
			//check to see if entity is one f the entities with a title
1196
			if (!in_array($object->getSubtype(), array('comment', 'discussion_reply', 'thewire', 'answer'))) {
1197
				if ($object->title3) {
1198
					$entName = gc_explode_translation($object->title3, $lang);
1199
				} else {
1200
					$entName = $object->title;
1201
				}
1202
			} else { //if not get owner instead of name
1203
				$entName = $object->getOwnerEntity()->name;
1204
			}
1205
		} elseif ($entContext == 'group') {
1206
			$contentType = 'group';
1207
			$entContext = elgg_echo('group');
1208
			if ($object->title3) {
1209
				$entName = gc_explode_translation($object->title3, $lang);
1210
			} else {
1211
				$entName = $object->name;
1212
			}
1213
		}
1214
1215
		//pass type and entiey/owner name to function to return array of text
1216
		$hiddenText = generate_hidden_text($contentType, $entName);