Code Duplication    Length = 25-25 lines in 2 locations

main/inc/lib/MoodleImport.php 2 locations

@@ 810-834 (lines=25) @@
807
     * @param array $importedFiles
808
     * @return integer db response
809
     */
810
    public function processUniqueAnswer($objAnswer, $answerValues, $position, &$questionWeighting, $importedFiles)
811
    {
812
        $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0;
813
        $answer = $answerValues['answertext'];
814
        $comment = $answerValues['feedback'];
815
        $weighting = $answerValues['fraction'];
816
        $weighting = abs($weighting);
817
        if ($weighting > 0) {
818
            $questionWeighting += $weighting;
819
        }
820
        $goodAnswer =  $correct ? true : false;
821
822
        $this->fixPathInText($importedFiles, $answer);
823
824
        $objAnswer->createAnswer(
825
            $answer,
826
            $goodAnswer,
827
            $comment,
828
            $weighting,
829
            $position,
830
            null,
831
            null,
832
            ''
833
        );
834
    }
835
836
    /**
837
     * Process Chamilo True False
@@ 847-871 (lines=25) @@
844
     *
845
     * @return integer db response
846
     */
847
    public function processTrueFalse($objAnswer, $answerValues, $position, &$questionWeighting, $importedFiles)
848
    {
849
        $correct = intval($answerValues['fraction']) ? intval($answerValues['fraction']) : 0;
850
        $answer = $answerValues['answertext'];
851
        $comment = $answerValues['feedback'];
852
        $weighting = $answerValues['fraction'];
853
        $weighting = abs($weighting);
854
        if ($weighting > 0) {
855
            $questionWeighting += $weighting;
856
        }
857
        $goodAnswer =  $correct ? true : false;
858
859
        $this->fixPathInText($importedFiles, $answer);
860
861
        $objAnswer->createAnswer(
862
            $answer,
863
            $goodAnswer,
864
            $comment,
865
            $weighting,
866
            $position,
867
            null,
868
            null,
869
            ''
870
        );
871
    }
872
873
    /**
874
     * Process Chamilo FillBlanks