Code Duplication    Length = 16-17 lines in 2 locations

src/PlaygroundGame/Service/Quiz.php 2 locations

@@ 408-424 (lines=17) @@
405
                if (is_array($a)) {
406
                    foreach ($a as $k => $answer_id) {
407
                        $answer = $this->getQuizAnswerMapper()->findById($answer_id);
408
                        if ($answer) {
409
                            $quizReplyAnswer = new QuizReplyAnswer();
410
                            $quizReplyAnswer->setAnswer($answer->getAnswer());
411
                            $quizReplyAnswer->setAnswerId($answer_id);
412
                            $quizReplyAnswer->setQuestion($question->getQuestion());
413
                            $quizReplyAnswer->setQuestionId($question->getId());
414
                            $quizReplyAnswer->setPoints($answer->getPoints());
415
                            $quizReplyAnswer->setCorrect($answer->getCorrect());
416
417
                            $quizReply->addAnswer($quizReplyAnswer);
418
                            $quizPoints += $answer->getPoints();
419
                            $quizCorrectAnswers += $answer->getCorrect();
420
421
                            if (isset($group[$q.'-'.$answer_id.'-data'])) {
422
                                $quizReplyAnswer->setAnswerData($group[$q.'-'.$answer_id.'-data']);
423
                            }
424
                        }
425
                    }
426
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
427
                    ++$totalQuestions;
@@ 429-444 (lines=16) @@
426
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
427
                    ++$totalQuestions;
428
                    $answer = $this->getQuizAnswerMapper()->findById($a);
429
                    if ($answer) {
430
                        $quizReplyAnswer = new QuizReplyAnswer();
431
                        $quizReplyAnswer->setAnswer($answer->getAnswer());
432
                        $quizReplyAnswer->setAnswerId($a);
433
                        $quizReplyAnswer->setQuestion($question->getQuestion());
434
                        $quizReplyAnswer->setQuestionId($question->getId());
435
                        $quizReplyAnswer->setPoints($answer->getPoints());
436
                        $quizReplyAnswer->setCorrect($answer->getCorrect());
437
438
                        $quizReply->addAnswer($quizReplyAnswer);
439
                        $quizPoints += $answer->getPoints();
440
                        $quizCorrectAnswers += $answer->getCorrect();
441
                        if (isset($group[$q.'-'.$a.'-data'])) {
442
                            $quizReplyAnswer->setAnswerData($group[$q.'-'.$a.'-data']);
443
                        }
444
                    }
445
                } elseif ($question->getType() == 2) {
446
                    ++$totalQuestions;
447
                    $quizReplyAnswer = new QuizReplyAnswer();