Code Duplication    Length = 5-9 lines in 2 locations

main/exercice/exercise.class.php 1 location

@@ 7073-7077 (lines=5) @@
7070
                if (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION))) {
7071
7072
                    $input_id = 'choice-'.$questionId.'-'.$answerId;
7073
                    if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
7074
                        $attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
7075
                    } else {
7076
                        $attributes = array('id' => $input_id);
7077
                    }
7078
7079
                    if ($debug_mark_answer) {
7080
                        if ($answerCorrect) {

main/inc/lib/exercise.lib.php 1 location

@@ 283-291 (lines=9) @@
280
                // Unique answer
281
                if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
282
                    $input_id = 'choice-' . $questionId . '-' . $answerId;
283
                    if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
284
                        $attributes = array(
285
                            'id' => $input_id,
286
                            'checked' => 1,
287
                            'selected' => 1
288
                        );
289
                    } else {
290
                        $attributes = array('id' => $input_id);
291
                    }
292
293
                    if ($debug_mark_answer) {
294
                        if ($answerCorrect) {