Code Duplication    Length = 10-11 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3695-3704 (lines=10) @@
3692
                                for ($j = 0; $j < count($listTeacherAnswerTemp); $j++) {
3693
                                    $correctAnswer = $listTeacherAnswerTemp[$j];
3694
                                    if (!$found) {
3695
                                        if (FillBlanks::isGoodStudentAnswer(
3696
                                            $studentAnswer,
3697
                                            $correctAnswer
3698
                                        )
3699
                                        ) {
3700
                                            $questionScore += $answerWeighting[$i];
3701
                                            $totalScore += $answerWeighting[$i];
3702
                                            $listTeacherAnswerTemp[$j] = "";
3703
                                            $found = true;
3704
                                        }
3705
                                    }
3706
                                }
3707
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;
@@ 3672-3682 (lines=11) @@
3669
                                }
3670
3671
                                $isAnswerCorrect = 0;
3672
                                if (FillBlanks::isGoodStudentAnswer($studentAnswer, $correctAnswer)) {
3673
                                    // gives the related weighting to the student
3674
                                    $questionScore += $answerWeighting[$i];
3675
                                    // increments total score
3676
                                    $totalScore += $answerWeighting[$i];
3677
                                    $isAnswerCorrect = 1;
3678
                                }
3679
                                $listCorrectAnswers['studentanswer'][$i] = $studentAnswer;
3680
                                $listCorrectAnswers['studentscore'][$i] = $isAnswerCorrect;
3681
                            }
3682
                        } else {
3683
                            // switchable answer
3684
                            $listStudentAnswerTemp = $choice;
3685
                            $listTeacherAnswerTemp = $listCorrectAnswers['tabwords'];