Code Duplication    Length = 31-31 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

@@ 391-421 (lines=31) @@
388
    /**
389
     * お届け先変更がクリックされた場合の処理
390
     */
391
    public function shippingChange(Application $app, Request $request, $id)
392
    {
393
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
394
        if (!$Order) {
395
            $app->addError('front.shopping.order.error');
396
            return $app->redirect($app->url('shopping_error'));
397
        }
398
399
        if ('POST' !== $request->getMethod()) {
400
            return $app->redirect($app->url('shopping'));
401
        }
402
403
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
404
        $form->handleRequest($request);
405
406
        if ($form->isSubmitted() && $form->isValid()) {
407
            $data = $form->getData();
408
            $message = $data['message'];
409
            $Order->setMessage($message);
410
            // 受注情報を更新
411
            $app['orm.em']->flush();
412
413
            // お届け先設定一覧へリダイレクト
414
            return $app->redirect($app->url('shopping_shipping', array('id' => $id)));
415
        }
416
417
        return $app->render('Shopping/index.twig', array(
418
            'form' => $form->createView(),
419
            'Order' => $Order,
420
        ));
421
    }
422
423
    /**
424
     * お届け先の設定一覧からの選択
@@ 496-526 (lines=31) @@
493
    /**
494
     * お届け先の設定(非会員)がクリックされた場合の処理
495
     */
496
    public function shippingEditChange(Application $app, Request $request, $id)
497
    {
498
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
499
        if (!$Order) {
500
            $app->addError('front.shopping.order.error');
501
            return $app->redirect($app->url('shopping_error'));
502
        }
503
504
        if ('POST' !== $request->getMethod()) {
505
            return $app->redirect($app->url('shopping'));
506
        }
507
508
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
509
        $form->handleRequest($request);
510
511
        if ($form->isSubmitted() && $form->isValid()) {
512
            $data = $form->getData();
513
            $message = $data['message'];
514
            $Order->setMessage($message);
515
            // 受注情報を更新
516
            $app['orm.em']->flush();
517
518
            // お届け先設定一覧へリダイレクト
519
            return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id)));
520
        }
521
522
        return $app->render('Shopping/index.twig', array(
523
            'form' => $form->createView(),
524
            'Order' => $Order,
525
        ));
526
    }
527
528
    /**
529
     * お届け先の設定(非会員でも使用する)
@@ 763-793 (lines=31) @@
760
    /**
761
     * 複数配送処理がクリックされた場合の処理
762
     */
763
    public function shippingMultipleChange(Application $app, Request $request)
764
    {
765
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
766
        if (!$Order) {
767
            $app->addError('front.shopping.order.error');
768
            return $app->redirect($app->url('shopping_error'));
769
        }
770
771
        if ('POST' !== $request->getMethod()) {
772
            return $app->redirect($app->url('shopping'));
773
        }
774
775
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
776
        $form->handleRequest($request);
777
778
        if ($form->isSubmitted() && $form->isValid()) {
779
            $data = $form->getData();
780
            $message = $data['message'];
781
            $Order->setMessage($message);
782
            // 受注情報を更新
783
            $app['orm.em']->flush();
784
785
            // 複数配送設定へリダイレクト
786
            return $app->redirect($app->url('shopping_shipping_multiple'));
787
        }
788
789
        return $app->render('Shopping/index.twig', array(
790
            'form' => $form->createView(),
791
            'Order' => $Order,
792
        ));
793
    }
794
795
796
    /**