From 9b0a096bd6a415a4058852fcb01c02ba0a08a4b9 Mon Sep 17 00:00:00 2001 From: Alexis Date: Fri, 3 Feb 2023 15:20:28 +0100 Subject: [PATCH] Add FactoryQuestion --- Source/Model/Factory.php | 16 ++++++++++++++++ Source/Model/FactoryQuestion.php | 33 ++++++++++++++++++++++++++++++++ Source/Model/ModelCandidate.php | 21 +------------------- 3 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 Source/Model/Factory.php create mode 100644 Source/Model/FactoryQuestion.php diff --git a/Source/Model/Factory.php b/Source/Model/Factory.php new file mode 100644 index 0000000..1b38731 --- /dev/null +++ b/Source/Model/Factory.php @@ -0,0 +1,16 @@ +create($results); + } +} \ No newline at end of file diff --git a/Source/Model/FactoryQuestion.php b/Source/Model/FactoryQuestion.php new file mode 100644 index 0000000..1192df1 --- /dev/null +++ b/Source/Model/FactoryQuestion.php @@ -0,0 +1,33 @@ +getAllQuestions($form[0]['id']); - $questions = []; - - for($i = 0; $i < count($questionsTab[0]); $i++) - { - if(strcmp($questionsTab[0][$i]['type'], "BusinessClass\TextQuestion") == 0) - { - $questions[] = new TextQuestion($questionsTab[0][$i]['content'], $questionsTab[0][$i]['id']); - } - else - { - $possiblesResponses = $questionsTab[1][$i]; - $content = $questionsTab[0][$i]['content']; - - $categories = $questionsTab[2][$i]; - - $id = $questionsTab[0][$i]['id']; - - $questions[] = new $questionsTab[0][$i]['type']($possiblesResponses, $content, $categories, $id); - } - } + $questions = Factory::getBuiltObjects($questionsTab, "Question"); $html = "

$title

\n