Code Duplication    Length = 13-19 lines in 2 locations

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

@@ 696-714 (lines=19) @@
693
        $BaseInfo = $app['eccube.repository.base_info']->get();
694
695
        // 選択された商品を登録
696
        foreach ($ProductClasses as $ProductClass) {
697
698
            $ProductClass->setDelFlg(Constant::DISABLED);
699
            $ProductClass->setProduct($Product);
700
            $app['orm.em']->persist($ProductClass);
701
702
            // 在庫情報を作成
703
            $ProductStock = new \Eccube\Entity\ProductStock();
704
            $ProductClass->setProductStock($ProductStock);
705
            $ProductStock->setProductClass($ProductClass);
706
            if (!$ProductClass->getStockUnlimited()) {
707
                $ProductStock->setStock($ProductClass->getStock());
708
            } else {
709
                // 在庫無制限時はnullを設定
710
                $ProductStock->setStock(null);
711
            }
712
            $app['orm.em']->persist($ProductStock);
713
714
        }
715
716
        // 商品税率が設定されている場合、商品税率をセット
717
        if ($BaseInfo->getOptionProductTaxRule() == Constant::ENABLED) {
@@ 722-734 (lines=13) @@
719
            $TaxRule = $app['eccube.repository.tax_rule']->find(\Eccube\Entity\TaxRule::DEFAULT_TAX_RULE_ID);
720
            // 初期税率設定の計算方法を設定する
721
            $CalcRule = $TaxRule->getCalcRule();
722
            foreach ($ProductClasses as $ProductClass) {
723
                if ($ProductClass->getTaxRate()) {
724
                    $TaxRule = new \Eccube\Entity\TaxRule();
725
                    $TaxRule->setProduct($Product);
726
                    $TaxRule->setProductClass($ProductClass);
727
                    $TaxRule->setCalcRule($CalcRule);
728
                    $TaxRule->setTaxRate($ProductClass->getTaxRate());
729
                    $TaxRule->setTaxAdjust(0);
730
                    $TaxRule->setApplyDate(new \DateTime());
731
                    $TaxRule->setDelFlg(Constant::DISABLED);
732
                    $app['orm.em']->persist($TaxRule);
733
                }
734
            }
735
        }
736
737
    }