From 8b0076709725a2272fe97e18124b389980fd16a9 Mon Sep 17 00:00:00 2001 From: Fitorec Date: Fri, 1 Jun 2018 00:37:36 -0500 Subject: [PATCH 1/2] Check the logic in method setAnswer on Ims2Question --- main/exercise/export/qti2/qti2_classes.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/main/exercise/export/qti2/qti2_classes.php b/main/exercise/export/qti2/qti2_classes.php index 9453f41654..14ed78f309 100755 --- a/main/exercise/export/qti2/qti2_classes.php +++ b/main/exercise/export/qti2/qti2_classes.php @@ -19,13 +19,7 @@ class Ims2Question extends Question { switch ($this->type) { case MCUA: - $answer = new ImsAnswerMultipleChoice($this->id); - - return $answer; case MCMA: - $answer = new ImsAnswerMultipleChoice($this->id); - - return $answer; case TF: $answer = new ImsAnswerMultipleChoice($this->id); @@ -47,12 +41,9 @@ class Ims2Question extends Question $answer = new ImsAnswerHotspot($this->id); return $answer; - default: - $answer = null; - break; } - return $answer; + return null; } public function createAnswersForm($form) From 9fd1db79c75f553a72be4f89fea6d67b16f5e26b Mon Sep 17 00:00:00 2001 From: Fitorec Date: Fri, 1 Jun 2018 09:29:52 -0500 Subject: [PATCH 2/2] Added default in switch --- main/exercise/export/qti2/qti2_classes.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main/exercise/export/qti2/qti2_classes.php b/main/exercise/export/qti2/qti2_classes.php index 14ed78f309..bf6c0febe6 100755 --- a/main/exercise/export/qti2/qti2_classes.php +++ b/main/exercise/export/qti2/qti2_classes.php @@ -17,6 +17,7 @@ class Ims2Question extends Question */ public function setAnswer() { + $answer = null; switch ($this->type) { case MCUA: case MCMA: @@ -41,9 +42,11 @@ class Ims2Question extends Question $answer = new ImsAnswerHotspot($this->id); return $answer; + default: + break; } - return null; + return $answer; } public function createAnswersForm($form)