Code Duplication    Length = 15-15 lines in 2 locations

main/exercise/exercise.class.php 2 locations

@@ 3613-3627 (lines=15) @@
3610
                            if (!$switchable_answer_set) {
3611
                                // Needed to parse ' and " characters
3612
                                $user_tags[$i] = stripslashes($user_tags[$i]);
3613
                                if ($correct_tags[$i] == $user_tags[$i]) {
3614
                                    // gives the related weighting to the student
3615
                                    $questionScore += $answerWeighting[$i];
3616
                                    // increments total score
3617
                                    $totalScore += $answerWeighting[$i];
3618
                                    // adds the word in green at the end of the string
3619
                                    $answer .= $correct_tags[$i];
3620
                                } elseif (!empty($user_tags[$i])) {
3621
                                    // else if the word entered by the student IS NOT the same as the one defined by the professor
3622
                                    // adds the word in red at the end of the string, and strikes it
3623
                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3624
                                } else {
3625
                                    // adds a tabulation if no word has been typed by the student
3626
                                    $answer .= ''; // remove &nbsp; that causes issue
3627
                                }
3628
                            } else {
3629
                                // switchable fill in the blanks
3630
                                if (in_array($user_tags[$i], $correct_tags)) {
@@ 3817-3831 (lines=15) @@
3814
                        }
3815
                        // Needed to parse ' and " characters
3816
                        $userTags[$i] = stripslashes($userTags[$i]);
3817
                        if ($correctTags[$i] == $userTags[$i]) {
3818
                            // gives the related weighting to the student
3819
                            $questionScore += $answerWeighting[$i];
3820
                            // increments total score
3821
                            $totalScore += $answerWeighting[$i];
3822
                            // adds the word in green at the end of the string
3823
                            $answer .= $correctTags[$i];
3824
                        } elseif (!empty($userTags[$i])) {
3825
                            // else if the word entered by the student IS NOT the same as the one defined by the professor
3826
                            // adds the word in red at the end of the string, and strikes it
3827
                            $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>';
3828
                        } else {
3829
                            // adds a tabulation if no word has been typed by the student
3830
                            $answer .= ''; // remove &nbsp; that causes issue
3831
                        }
3832
                        // adds the correct word, followed by ] to close the blank
3833
3834
                        if (