Code Duplication    Length = 13-13 lines in 2 locations

src/Eccube/Controller/Mypage/MypageController.php 1 location

@@ 268-280 (lines=13) @@
265
266
                    // 明細の正規化
267
                    $Carts = $this->cartService->getCarts();
268
                    foreach ($Carts as $Cart) {
269
                        $result = $this->purchaseFlow->validate($Cart, new PurchaseContext($Cart, $this->getUser()));
270
                        // 復旧不可のエラーが発生した場合は追加した明細を削除.
271
                        if ($result->hasError()) {
272
                            $this->cartService->removeProduct($OrderItem->getProductClass());
273
                            foreach ($result->getErrors() as $error) {
274
                                $errorMessages[] = $error->getMessage();
275
                            }
276
                        }
277
                        foreach ($result->getWarning() as $warning) {
278
                            $errorMessages[] = $warning->getMessage();
279
                        }
280
                    }
281
282
                    $this->cartService->save();
283
                }

src/Eccube/Controller/ProductController.php 1 location

@@ 420-432 (lines=13) @@
417
418
        // 明細の正規化
419
        $Carts = $this->cartService->getCarts();
420
        foreach ($Carts as $Cart) {
421
            $result = $this->purchaseFlow->validate($Cart, new PurchaseContext($Cart, $this->getUser()));
422
            // 復旧不可のエラーが発生した場合は追加した明細を削除.
423
            if ($result->hasError()) {
424
                $this->cartService->removeProduct($addCartData['product_class_id']);
425
                foreach ($result->getErrors() as $error) {
426
                    $errorMessages[] = $error->getMessage();
427
                }
428
            }
429
            foreach ($result->getWarning() as $warning) {
430
                $errorMessages[] = $warning->getMessage();
431
            }
432
        }
433
        // エラーが発生していた場合は再度正規化をする
434
        if (!empty($errorMessages)) {
435
            $Carts = $this->cartService->getCarts();