Code Duplication    Length = 15-15 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3550-3564 (lines=15) @@
3547
                            if (!$switchable_answer_set) {
3548
                                // Needed to parse ' and " characters
3549
                                $user_tags[$i] = stripslashes($user_tags[$i]);
3550
                                if ($correct_tags[$i] == $user_tags[$i]) {
3551
                                    // gives the related weighting to the student
3552
                                    $questionScore += $answerWeighting[$i];
3553
                                    // increments total score
3554
                                    $totalScore += $answerWeighting[$i];
3555
                                    // adds the word in green at the end of the string
3556
                                    $answer .= $correct_tags[$i];
3557
                                } elseif (!empty($user_tags[$i])) {
3558
                                    // else if the word entered by the student IS NOT the same as the one defined by the professor
3559
                                    // adds the word in red at the end of the string, and strikes it
3560
                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3561
                                } else {
3562
                                    // adds a tabulation if no word has been typed by the student
3563
                                    $answer .= ''; // remove &nbsp; that causes issue
3564
                                }
3565
                            } else {
3566
                                // switchable fill in the blanks
3567
                                if (in_array($user_tags[$i], $correct_tags)) {
@@ 3759-3773 (lines=15) @@
3756
                        }
3757
                        // Needed to parse ' and " characters
3758
                        $userTags[$i] = stripslashes($userTags[$i]);
3759
                        if ($correctTags[$i] == $userTags[$i]) {
3760
                            // gives the related weighting to the student
3761
                            $questionScore += $answerWeighting[$i];
3762
                            // increments total score
3763
                            $totalScore += $answerWeighting[$i];
3764
                            // adds the word in green at the end of the string
3765
                            $answer .= $correctTags[$i];
3766
                        } elseif (!empty($userTags[$i])) {
3767
                            // else if the word entered by the student IS NOT the same as the one defined by the professor
3768
                            // adds the word in red at the end of the string, and strikes it
3769
                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3770
                        } else {
3771
                            // adds a tabulation if no word has been typed by the student
3772
                            $answer .= ''; // remove &nbsp; that causes issue
3773
                        }
3774
                        // adds the correct word, followed by ] to close the blank
3775
3776
                        if (