Code Duplication    Length = 43-43 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

@@ 519-561 (lines=43) @@
516
    /**
517
     * お届け先変更がクリックされた場合の処理
518
     */
519
    public function shippingChange(Application $app, Request $request, $id)
520
    {
521
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
522
        if (!$Order) {
523
            $app->addError('front.shopping.order.error');
524
            return $app->redirect($app->url('shopping_error'));
525
        }
526
527
        if ('POST' !== $request->getMethod()) {
528
            return $app->redirect($app->url('shopping'));
529
        }
530
531
        $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
532
533
        $event = new EventArgs(
534
            array(
535
                'builder' => $builder,
536
                'Order' => $Order,
537
            ),
538
            $request
539
        );
540
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_CHANGE_INITIALIZE, $event);
541
542
        $form = $builder->getForm();
543
544
        $form->handleRequest($request);
545
546
        if ($form->isSubmitted() && $form->isValid()) {
547
            $data = $form->getData();
548
            $message = $data['message'];
549
            $Order->setMessage($message);
550
            // 受注情報を更新
551
            $app['orm.em']->flush();
552
553
            // お届け先設定一覧へリダイレクト
554
            return $app->redirect($app->url('shopping_shipping', array('id' => $id)));
555
        }
556
557
        return $app->render('Shopping/index.twig', array(
558
            'form' => $form->createView(),
559
            'Order' => $Order,
560
        ));
561
    }
562
563
    /**
564
     * お届け先の設定一覧からの選択
@@ 654-696 (lines=43) @@
651
    /**
652
     * お届け先の設定(非会員)がクリックされた場合の処理
653
     */
654
    public function shippingEditChange(Application $app, Request $request, $id)
655
    {
656
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
657
        if (!$Order) {
658
            $app->addError('front.shopping.order.error');
659
            return $app->redirect($app->url('shopping_error'));
660
        }
661
662
        if ('POST' !== $request->getMethod()) {
663
            return $app->redirect($app->url('shopping'));
664
        }
665
666
        $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
667
668
        $event = new EventArgs(
669
            array(
670
                'builder' => $builder,
671
                'Order' => $Order,
672
            ),
673
            $request
674
        );
675
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_EDIT_CHANGE_INITIALIZE, $event);
676
677
        $form = $builder->getForm();
678
679
        $form->handleRequest($request);
680
681
        if ($form->isSubmitted() && $form->isValid()) {
682
            $data = $form->getData();
683
            $message = $data['message'];
684
            $Order->setMessage($message);
685
            // 受注情報を更新
686
            $app['orm.em']->flush();
687
688
            // お届け先設定一覧へリダイレクト
689
            return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id)));
690
        }
691
692
        return $app->render('Shopping/index.twig', array(
693
            'form' => $form->createView(),
694
            'Order' => $Order,
695
        ));
696
    }
697
698
    /**
699
     * お届け先の設定(非会員でも使用する)
@@ 1061-1103 (lines=43) @@
1058
    /**
1059
     * 複数配送処理がクリックされた場合の処理
1060
     */
1061
    public function shippingMultipleChange(Application $app, Request $request)
1062
    {
1063
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
1064
        if (!$Order) {
1065
            $app->addError('front.shopping.order.error');
1066
            return $app->redirect($app->url('shopping_error'));
1067
        }
1068
1069
        if ('POST' !== $request->getMethod()) {
1070
            return $app->redirect($app->url('shopping'));
1071
        }
1072
1073
        $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
1074
1075
        $event = new EventArgs(
1076
            array(
1077
                'builder' => $builder,
1078
                'Order' => $Order,
1079
            ),
1080
            $request
1081
        );
1082
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_MULTIPLE_CHANGE_INITIALIZE, $event);
1083
1084
        $form = $builder->getForm();
1085
1086
        $form->handleRequest($request);
1087
1088
        if ($form->isSubmitted() && $form->isValid()) {
1089
            $data = $form->getData();
1090
            $message = $data['message'];
1091
            $Order->setMessage($message);
1092
            // 受注情報を更新
1093
            $app['orm.em']->flush();
1094
1095
            // 複数配送設定へリダイレクト
1096
            return $app->redirect($app->url('shopping_shipping_multiple'));
1097
        }
1098
1099
        return $app->render('Shopping/index.twig', array(
1100
            'form' => $form->createView(),
1101
            'Order' => $Order,
1102
        ));
1103
    }
1104
1105
1106
    /**