Code Duplication    Length = 16-17 lines in 2 locations

src/PlaygroundGame/Service/Quiz.php 2 locations

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