Code Duplication    Length = 13-15 lines in 2 locations

src/Eccube/Controller/Admin/Product/CsvImportController.php 2 locations

@@ 408-420 (lines=13) @@
405
                                    if (isset($row[$headerByKey['class_category2']]) && StringUtil::isNotBlank($row[$headerByKey['class_category2']])) {
406
                                        if (preg_match('/^\d+$/', $row[$headerByKey['class_category2']])) {
407
                                            $ClassCategory2 = $this->classCategoryRepository->find($row[$headerByKey['class_category2']]);
408
                                            if (!$ClassCategory2) {
409
                                                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
410
                                                $this->addErrors($message);
411
                                            } else {
412
                                                if ($ClassCategory1 &&
413
                                                    ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId())
414
                                                ) {
415
                                                    $message = trans('admin.common.csv_invalid_not_same', ['%line%' => $line, '%name1%' => $headerByKey['class_category1'], '%name2%' => $headerByKey['class_category2']]);
416
                                                    $this->addErrors($message);
417
                                                } else {
418
                                                    $ProductClass->setClassCategory2($ClassCategory2);
419
                                                }
420
                                            }
421
                                        } else {
422
                                            $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
423
                                            $this->addErrors($message);
@@ 544-558 (lines=15) @@
541
                                        } else {
542
                                            if (preg_match('/^\d+$/', $classCategoryId2)) {
543
                                                $ClassCategory2 = $this->classCategoryRepository->find($classCategoryId2);
544
                                                if (!$ClassCategory2) {
545
                                                    $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
546
                                                    $this->addErrors($message);
547
                                                } else {
548
                                                    if ($ClassCategory1 &&
549
                                                        ($ClassCategory1->getClassName()->getId() == $ClassCategory2->getClassName()->getId())
550
                                                    ) {
551
                                                        $message = trans('admin.common.csv_invalid_not_same', [
552
                                                            '%line%' => $line,
553
                                                            '%name1%' => $headerByKey['class_category1'],
554
                                                            '%name2%' => $headerByKey['class_category2'],
555
                                                        ]);
556
                                                        $this->addErrors($message);
557
                                                    }
558
                                                }
559
                                            } else {
560
                                                $message = trans('admin.common.csv_invalid_not_found', ['%line%' => $line, '%name%' => $headerByKey['class_category2']]);
561
                                                $this->addErrors($message);