Code Duplication    Length = 15-15 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3591-3605 (lines=15) @@
3588
                            if (!$switchable_answer_set) {
3589
                                // Needed to parse ' and " characters
3590
                                $user_tags[$i] = stripslashes($user_tags[$i]);
3591
                                if ($correct_tags[$i] == $user_tags[$i]) {
3592
                                    // gives the related weighting to the student
3593
                                    $questionScore += $answerWeighting[$i];
3594
                                    // increments total score
3595
                                    $totalScore += $answerWeighting[$i];
3596
                                    // adds the word in green at the end of the string
3597
                                    $answer .= $correct_tags[$i];
3598
                                } elseif (!empty($user_tags[$i])) {
3599
                                    // else if the word entered by the student IS NOT the same as the one defined by the professor
3600
                                    // adds the word in red at the end of the string, and strikes it
3601
                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3602
                                } else {
3603
                                    // adds a tabulation if no word has been typed by the student
3604
                                    $answer .= ''; // remove &nbsp; that causes issue
3605
                                }
3606
                            } else {
3607
                                // switchable fill in the blanks
3608
                                if (in_array($user_tags[$i], $correct_tags)) {
@@ 3805-3819 (lines=15) @@
3802
                        }
3803
                        // Needed to parse ' and " characters
3804
                        $userTags[$i] = stripslashes($userTags[$i]);
3805
                        if ($correctTags[$i] == $userTags[$i]) {
3806
                            // gives the related weighting to the student
3807
                            $questionScore += $answerWeighting[$i];
3808
                            // increments total score
3809
                            $totalScore += $answerWeighting[$i];
3810
                            // adds the word in green at the end of the string
3811
                            $answer .= $correctTags[$i];
3812
                        } elseif (!empty($userTags[$i])) {
3813
                            // else if the word entered by the student IS NOT the same as the one defined by the professor
3814
                            // adds the word in red at the end of the string, and strikes it
3815
                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3816
                        } else {
3817
                            // adds a tabulation if no word has been typed by the student
3818
                            $answer .= ''; // remove &nbsp; that causes issue
3819
                        }
3820
                        // adds the correct word, followed by ] to close the blank
3821
3822
                        if (