Code Duplication    Length = 16-17 lines in 2 locations

src/PlaygroundGame/Service/Quiz.php 2 locations

@@ 379-395 (lines=17) @@
376
                if (is_array($a)) {
377
                    foreach ($a as $k => $answer_id) {
378
                        $answer = $this->getQuizAnswerMapper()->findById($answer_id);
379
                        if ($answer) {
380
                            $quizReplyAnswer = new QuizReplyAnswer();
381
                            $quizReplyAnswer->setAnswer($answer->getAnswer());
382
                            $quizReplyAnswer->setAnswerId($answer_id);
383
                            $quizReplyAnswer->setQuestion($question->getQuestion());
384
                            $quizReplyAnswer->setQuestionId($question->getId());
385
                            $quizReplyAnswer->setPoints($answer->getPoints());
386
                            $quizReplyAnswer->setCorrect($answer->getCorrect());
387
388
                            $quizReply->addAnswer($quizReplyAnswer);
389
                            $quizPoints += $answer->getPoints();
390
                            $quizCorrectAnswers += $answer->getCorrect();
391
392
                            if (isset($group[$q.'-'.$answer_id.'-data'])) {
393
                                $quizReplyAnswer->setAnswerData($group[$q.'-'.$answer_id.'-data']);
394
                            }
395
                        }
396
                    }
397
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
398
                    ++$totalQuestions;
@@ 400-415 (lines=16) @@
397
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
398
                    ++$totalQuestions;
399
                    $answer = $this->getQuizAnswerMapper()->findById($a);
400
                    if ($answer) {
401
                        $quizReplyAnswer = new QuizReplyAnswer();
402
                        $quizReplyAnswer->setAnswer($answer->getAnswer());
403
                        $quizReplyAnswer->setAnswerId($a);
404
                        $quizReplyAnswer->setQuestion($question->getQuestion());
405
                        $quizReplyAnswer->setQuestionId($question->getId());
406
                        $quizReplyAnswer->setPoints($answer->getPoints());
407
                        $quizReplyAnswer->setCorrect($answer->getCorrect());
408
409
                        $quizReply->addAnswer($quizReplyAnswer);
410
                        $quizPoints += $answer->getPoints();
411
                        $quizCorrectAnswers += $answer->getCorrect();
412
                        if (isset($group[$q.'-'.$a.'-data'])) {
413
                            $quizReplyAnswer->setAnswerData($group[$q.'-'.$a.'-data']);
414
                        }
415
                    }
416
                } elseif ($question->getType() == 2) {
417
                    ++$totalQuestions;
418
                    $quizReplyAnswer = new QuizReplyAnswer();