Code Duplication    Length = 5-9 lines in 2 locations

main/exercice/exercise.class.php 1 location

@@ 7020-7024 (lines=5) @@
7017
                if (in_array($answerType, array(UNIQUE_ANSWER, UNIQUE_ANSWER_IMAGE, UNIQUE_ANSWER_NO_OPTION))) {
7018
7019
                    $input_id = 'choice-'.$questionId.'-'.$answerId;
7020
                    if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
7021
                        $attributes = array('id' => $input_id, 'checked' => 1, 'selected' => 1);
7022
                    } else {
7023
                        $attributes = array('id' => $input_id);
7024
                    }
7025
7026
                    if ($debug_mark_answer) {
7027
                        if ($answerCorrect) {

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

@@ 276-284 (lines=9) @@
273
                // Unique answer
274
                if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
275
                    $input_id = 'choice-' . $questionId . '-' . $answerId;
276
                    if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) {
277
                        $attributes = array(
278
                            'id' => $input_id,
279
                            'checked' => 1,
280
                            'selected' => 1
281
                        );
282
                    } else {
283
                        $attributes = array('id' => $input_id);
284
                    }
285
286
                    if ($debug_mark_answer) {
287
                        if ($answerCorrect) {