Passed
Push — 1.11.x ( d8c231...69d982 )
by Yannick
09:30 queued 14s
created

CcAssesmentQuestionEssay::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 15
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 8

How to fix   Many Parameters   

Many Parameters

Methods with many parameters are not only hard to understand, but their parameters also often become inconsistent when you need more, or different data.

There are several approaches to avoid long parameter lists:

1
<?php
2
/* Source: https://github.com/moodle/moodle/blob/MOODLE_310_STABLE/backup/cc/cc_lib/cc_asssesment.php under GNU/GPL license */
3
4
class CcAssesmentQuestionEssay extends CcAssesmentQuestionProcBase
5
{
6
    public function __construct($quiz, $questions, $manifest, $section, $question, $rootpath, $contextid, $outdir)
7
    {
8
        parent::__construct($quiz, $questions, $manifest, $section, $question, $rootpath, $contextid, $outdir);
9
        $this->qtype = CcQtiProfiletype::ESSAY;
10
11
        $questionScore = $question->ponderation;
12
        /*
13
        // Looks useless for CC13!?
14
        if (is_int($questionScore)) {
15
            $questionScore = ($questionScore).'.0000000';
16
        }
17
        */
18
        $this->total_grade_value = $questionScore;
19
        $this->totalGradeValue = $questionScore;
20
        $this->qitem->setTitle($question->question);
21
    }
22
23
    public function onGenerateAnswers()
24
    {
25
        //add responses holder
26
        $answerlist = [];
27
        $this->answerlist = $answerlist;
28
    }
29
30
    public function onGenerateFeedbacks()
31
    {
32
        parent::onGenerateFeedbacks();
33
    }
34
35
    public function onGenerateResponseProcessing()
36
    {
37
        parent::onGenerateResponseProcessing();
38
39
        /**
40
         * General unconditional feedback must be added as a first respcondition
41
         * without any condition and just displayfeedback (if exists).
42
         */
43
        $qrespcondition = new CcAssesmentRespconditiontype();
44
        $qrespcondition->setTitle('General feedback');
45
        $this->qresprocessing->addRespcondition($qrespcondition);
46
        $qrespcondition->enableContinue();
47
    }
48
}
49