Code Duplication    Length = 16-17 lines in 2 locations

src/PlaygroundGame/Service/Quiz.php 2 locations

@@ 355-371 (lines=17) @@
352
                if (is_array($a)) {
353
                    foreach ($a as $k => $answer_id) {
354
                        $answer = $this->getQuizAnswerMapper()->findById($answer_id);
355
                        if ($answer) {
356
                            $quizReplyAnswer = new QuizReplyAnswer();
357
                            $quizReplyAnswer->setAnswer($answer->getAnswer());
358
                            $quizReplyAnswer->setAnswerId($answer_id);
359
                            $quizReplyAnswer->setQuestion($question->getQuestion());
360
                            $quizReplyAnswer->setQuestionId($question->getId());
361
                            $quizReplyAnswer->setPoints($answer->getPoints());
362
                            $quizReplyAnswer->setCorrect($answer->getCorrect());
363
364
                            $quizReply->addAnswer($quizReplyAnswer);
365
                            $quizPoints += $answer->getPoints();
366
                            $quizCorrectAnswers += $answer->getCorrect();
367
368
                            if (isset($group[$q.'-'.$answer_id.'-data'])) {
369
                                $quizReplyAnswer->setAnswerData($group[$q.'-'.$answer_id.'-data']);
370
                            }
371
                        }
372
                    }
373
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
374
                    ++$totalQuestions;
@@ 376-391 (lines=16) @@
373
                } elseif ($question->getType() == 0 || $question->getType() == 1) {
374
                    ++$totalQuestions;
375
                    $answer = $this->getQuizAnswerMapper()->findById($a);
376
                    if ($answer) {
377
                        $quizReplyAnswer = new QuizReplyAnswer();
378
                        $quizReplyAnswer->setAnswer($answer->getAnswer());
379
                        $quizReplyAnswer->setAnswerId($a);
380
                        $quizReplyAnswer->setQuestion($question->getQuestion());
381
                        $quizReplyAnswer->setQuestionId($question->getId());
382
                        $quizReplyAnswer->setPoints($answer->getPoints());
383
                        $quizReplyAnswer->setCorrect($answer->getCorrect());
384
385
                        $quizReply->addAnswer($quizReplyAnswer);
386
                        $quizPoints += $answer->getPoints();
387
                        $quizCorrectAnswers += $answer->getCorrect();
388
                        if (isset($group[$q.'-'.$a.'-data'])) {
389
                            $quizReplyAnswer->setAnswerData($group[$q.'-'.$a.'-data']);
390
                        }
391
                    }
392
                } elseif ($question->getType() == 2) {
393
                    ++$totalQuestions;
394
                    $quizReplyAnswer = new QuizReplyAnswer();