Code Duplication    Length = 16-17 lines in 2 locations

src/PlaygroundGame/Service/Quiz.php 2 locations

@@ 331-347 (lines=17) @@
328
                if (is_array($a)) {
329
                    foreach ($a as $k => $answer_id) {
330
                        $answer = $this->getQuizAnswerMapper()->findById($answer_id);
331
                        if ($answer) {
332
                            $quizReplyAnswer = new QuizReplyAnswer();
333
                            $quizReplyAnswer->setAnswer($answer->getAnswer());
334
                            $quizReplyAnswer->setAnswerId($answer_id);
335
                            $quizReplyAnswer->setQuestion($question->getQuestion());
336
                            $quizReplyAnswer->setQuestionId($question->getId());
337
                            $quizReplyAnswer->setPoints($answer->getPoints());
338
                            $quizReplyAnswer->setCorrect($answer->getCorrect());
339
340
                            $quizReply->addAnswer($quizReplyAnswer);
341
                            $quizPoints += $answer->getPoints();
342
                            $quizCorrectAnswers += $answer->getCorrect();
343
344
                            if (isset($group[$q.'-'.$answer_id.'-data'])) {
345
                                $quizReplyAnswer->setAnswerData($group[$q.'-'.$answer_id.'-data']);
346
                            }
347
                        }
348
                    }
349
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
350
                    ++$totalQuestions;
@@ 352-367 (lines=16) @@
349
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
350
                    ++$totalQuestions;
351
                    $answer = $this->getQuizAnswerMapper()->findById($a);
352
                    if ($answer) {
353
                        $quizReplyAnswer = new QuizReplyAnswer();
354
                        $quizReplyAnswer->setAnswer($answer->getAnswer());
355
                        $quizReplyAnswer->setAnswerId($a);
356
                        $quizReplyAnswer->setQuestion($question->getQuestion());
357
                        $quizReplyAnswer->setQuestionId($question->getId());
358
                        $quizReplyAnswer->setPoints($answer->getPoints());
359
                        $quizReplyAnswer->setCorrect($answer->getCorrect());
360
361
                        $quizReply->addAnswer($quizReplyAnswer);
362
                        $quizPoints += $answer->getPoints();
363
                        $quizCorrectAnswers += $answer->getCorrect();
364
                        if (isset($group[$q.'-'.$a.'-data'])) {
365
                            $quizReplyAnswer->setAnswerData($group[$q.'-'.$a.'-data']);
366
                        }
367
                    }
368
                } elseif ($question->getType() == 2) {
369
                    ++$totalQuestions;
370
                    $quizReplyAnswer = new QuizReplyAnswer();