Code Duplication    Length = 19-26 lines in 2 locations

main/survey/survey.lib.php 2 locations

@@ 3442-3467 (lines=26) @@
3439
                        $tableHtml .=  '<tr>';
3440
                        for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
3441
                            if ($question_x['type'] == 'score') {
3442
                                for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
3443
                                    if ($ii == 0) {
3444
                                        $tableHtml .=  '<th>'.$question_y['answers'][($ij)].' '.$y.'</th>';
3445
                                        break;
3446
                                    } else {
3447
                                        $tableHtml .=  '<td align="center">';
3448
                                        $votes = SurveyUtil::comparative_check(
3449
                                            $answers_x,
3450
                                            $answers_y,
3451
                                            $question_x['answersid'][($ii - 1)],
3452
                                            $question_y['answersid'][($ij)],
3453
                                            $x,
3454
                                            $y
3455
                                        );
3456
                                        $tableHtml .=  $votes;
3457
                                        array_push(
3458
                                            $chartData,
3459
                                            array(
3460
                                                'serie' => array($currentYQuestion, $xOptions[$ii-1]),
3461
                                                'option' => $x,
3462
                                                'votes' => $votes
3463
                                            )
3464
                                        );
3465
                                        $tableHtml .=  '</td>';
3466
                                    }
3467
                                }
3468
                            } else {
3469
                                if ($ii == 0) {
3470
                                    $tableHtml .= '<th>'.$question_y['answers'][$ij].' '.$y.'</th>';
@@ 3502-3520 (lines=19) @@
3499
                    $tableHtml .=  '<tr>';
3500
                    for ($ii = 0; $ii <= count($question_x['answers']); $ii++) {
3501
                        if ($question_x['type'] == 'score') {
3502
                            for ($x = 1; $x <= $question_x['maximum_score']; $x++) {
3503
                                if ($ii == 0) {
3504
                                    $tableHtml .=  '<th>'.$question_y['answers'][$ij].'</th>';
3505
                                    break;
3506
                                } else {
3507
                                    $tableHtml .=  '<td align="center">';
3508
                                    $votes =  SurveyUtil::comparative_check(
3509
                                        $answers_x,
3510
                                        $answers_y,
3511
                                        $question_x['answersid'][($ii-1)],
3512
                                        $question_y['answersid'][($ij)],
3513
                                        $x,
3514
                                        0
3515
                                    );
3516
                                    $tableHtml .= $votes;
3517
                                    array_push(
3518
                                        $chartData,
3519
                                        array(
3520
                                            'serie' => array($currentYQuestion, $xOptions[$ii-1]),
3521
                                            'option' => $x,
3522
                                            'votes' => $votes
3523
                                        )