Code Duplication    Length = 25-25 lines in 2 locations

main/exercise/question.class.php 2 locations

@@ 1029-1053 (lines=25) @@
1026
                );
1027
1028
                // If hotspot, create first answer
1029
                if ($type == HOT_SPOT || $type == HOT_SPOT_ORDER) {
1030
                    $quizAnswer = new CQuizAnswer();
1031
                    $quizAnswer
1032
                        ->setCId($c_id)
1033
                        ->setQuestionId($this->id)
1034
                        ->setAnswer('')
1035
                        ->setPonderation(10)
1036
                        ->setPosition(1)
1037
                        ->setHotspotCoordinates('0;0|0|0')
1038
                        ->setHotspotType('square');
1039
1040
                    $em->persist($quizAnswer);
1041
                    $em->flush();
1042
1043
                    $id = $quizAnswer->getIid();
1044
1045
                    if ($id) {
1046
                        $quizAnswer
1047
                            ->setId($id)
1048
                            ->setIdAuto($id);
1049
1050
                        $em->merge($quizAnswer);
1051
                        $em->flush();
1052
                    }
1053
                }
1054
1055
                if ($type == HOT_SPOT_DELINEATION) {
1056
                    $quizAnswer = new CQuizAnswer();
@@ 1055-1079 (lines=25) @@
1052
                    }
1053
                }
1054
1055
                if ($type == HOT_SPOT_DELINEATION) {
1056
                    $quizAnswer = new CQuizAnswer();
1057
                    $quizAnswer
1058
                        ->setCId($c_id)
1059
                        ->setQuestionId($this->id)
1060
                        ->setAnswer('')
1061
                        ->setPonderation(10)
1062
                        ->setPosition(1)
1063
                        ->setHotspotCoordinates('0;0|0|0')
1064
                        ->setHotspotType('delineation');
1065
1066
                    $em->persist($quizAnswer);
1067
                    $em->flush();
1068
1069
                    $id = $quizAnswer->getIid();
1070
1071
                    if ($id) {
1072
                        $quizAnswer
1073
                            ->setId($id)
1074
                            ->setIdAuto($id);
1075
1076
                        $em->merge($quizAnswer);
1077
                        $em->flush();
1078
                    }
1079
                }
1080
1081
                if (api_get_setting('search_enabled') == 'true') {
1082
                    if ($exerciseId != 0) {