Code Duplication    Length = 14-15 lines in 2 locations

main/inc/lib/MoodleImport.class.php 2 locations

@@ 547-561 (lines=15) @@
544
    public function processAnswers($questionList, $questionType, $questionInstance, $currentQuestion)
545
    {
546
        switch ($questionType) {
547
            case 'multichoice':
548
                $objAnswer = new Answer($questionInstance->id);
549
                $questionWeighting = 0;
550
                foreach ($questionList as $slot => $answer) {
551
                    $this->processUniqueAnswer($objAnswer, $answer, $slot + 1, $questionWeighting);
552
                }
553
554
                // saves the answers into the data base
555
                $objAnswer->save();
556
                // sets the total weighting of the question
557
                $questionInstance->updateWeighting($questionWeighting);
558
                $questionInstance->save();
559
560
                return true;
561
                break;
562
            case 'multianswer':
563
                $objAnswer = new Answer($questionInstance->id);
564
@@ 645-658 (lines=14) @@
642
                $questionInstance->save();
643
                return true;
644
                break;
645
            case 'truefalse':
646
                $objAnswer = new Answer($questionInstance->id);
647
                $questionWeighting = 0;
648
                foreach ($questionList as $slot => $answer) {
649
                    $this->processTrueFalse($objAnswer, $answer, $slot + 1, $questionWeighting);
650
                }
651
652
                // saves the answers into the data base
653
                $objAnswer->save();
654
                // sets the total weighting of the question
655
                $questionInstance->updateWeighting($questionWeighting);
656
                $questionInstance->save();
657
                return false;
658
                break;
659
            default:
660
                return false;
661
                break;