Code Duplication    Length = 24-24 lines in 2 locations

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

@@ 838-861 (lines=24) @@
835
            $ProductClass->setCode(null);
836
        }
837
838
        if ($row['在庫数無制限フラグ'] == '') {
839
            $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
840
        } else {
841
            if ($row['在庫数無制限フラグ'] == (string) Constant::DISABLED) {
842
                $ProductClass->setStockUnlimited(Constant::DISABLED);
843
                // 在庫数が設定されていなければエラー
844
                if ($row['在庫数'] == '') {
845
                    $this->addErrors(($data->key() + 1) . '行目の在庫数が設定されていません。');
846
                } else {
847
                    $stock = str_replace(',', '', $row['在庫数']);
848
                    if (preg_match('/^\d+$/', $stock) && $stock >= 0) {
849
                        $ProductClass->setStock($stock);
850
                    } else {
851
                        $this->addErrors(($data->key() + 1) . '行目の在庫数は0以上の数値を設定してください。');
852
                    }
853
                }
854
855
            } else if ($row['在庫数無制限フラグ'] == (string) Constant::ENABLED) {
856
                $ProductClass->setStockUnlimited(Constant::ENABLED);
857
                $ProductClass->setStock(null);
858
            } else {
859
                $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
860
            }
861
        }
862
863
        if ($row['販売制限数'] != '') {
864
            $saleLimit = str_replace(',', '', $row['販売制限数']);
@@ 1000-1023 (lines=24) @@
997
            $ProductClass->setCode(null);
998
        }
999
1000
        if ($row['在庫数無制限フラグ'] == '') {
1001
            $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
1002
        } else {
1003
            if ($row['在庫数無制限フラグ'] == (string) Constant::DISABLED) {
1004
                $ProductClass->setStockUnlimited(Constant::DISABLED);
1005
                // 在庫数が設定されていなければエラー
1006
                if ($row['在庫数'] == '') {
1007
                    $this->addErrors(($data->key() + 1) . '行目の在庫数が設定されていません。');
1008
                } else {
1009
                    $stock = str_replace(',', '', $row['在庫数']);
1010
                    if (preg_match('/^\d+$/', $stock) && $stock >= 0) {
1011
                        $ProductClass->setStock($row['在庫数']);
1012
                    } else {
1013
                        $this->addErrors(($data->key() + 1) . '行目の在庫数は0以上の数値を設定してください。');
1014
                    }
1015
                }
1016
1017
            } else if ($row['在庫数無制限フラグ'] == (string) Constant::ENABLED) {
1018
                $ProductClass->setStockUnlimited(Constant::ENABLED);
1019
                $ProductClass->setStock(null);
1020
            } else {
1021
                $this->addErrors(($data->key() + 1) . '行目の在庫数無制限フラグが設定されていません。');
1022
            }
1023
        }
1024
1025
        if ($row['販売制限数'] != '') {
1026
            $saleLimit = str_replace(',', '', $row['販売制限数']);