Code Duplication    Length = 43-43 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

@@ 542-584 (lines=43) @@
539
    /**
540
     * お届け先変更がクリックされた場合の処理
541
     */
542
    public function shippingChange(Application $app, Request $request, $id)
543
    {
544
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
545
        if (!$Order) {
546
            $app->addError('front.shopping.order.error');
547
            return $app->redirect($app->url('shopping_error'));
548
        }
549
550
        if ('POST' !== $request->getMethod()) {
551
            return $app->redirect($app->url('shopping'));
552
        }
553
554
        $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
555
556
        $event = new EventArgs(
557
            array(
558
                'builder' => $builder,
559
                'Order' => $Order,
560
            ),
561
            $request
562
        );
563
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_CHANGE_INITIALIZE, $event);
564
565
        $form = $builder->getForm();
566
567
        $form->handleRequest($request);
568
569
        if ($form->isSubmitted() && $form->isValid()) {
570
            $data = $form->getData();
571
            $message = $data['message'];
572
            $Order->setMessage($message);
573
            // 受注情報を更新
574
            $app['orm.em']->flush();
575
576
            // お届け先設定一覧へリダイレクト
577
            return $app->redirect($app->url('shopping_shipping', array('id' => $id)));
578
        }
579
580
        return $app->render('Shopping/index.twig', array(
581
            'form' => $form->createView(),
582
            'Order' => $Order,
583
        ));
584
    }
585
586
    /**
587
     * お届け先の設定一覧からの選択
@@ 677-719 (lines=43) @@
674
    /**
675
     * お届け先の設定(非会員)がクリックされた場合の処理
676
     */
677
    public function shippingEditChange(Application $app, Request $request, $id)
678
    {
679
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
680
        if (!$Order) {
681
            $app->addError('front.shopping.order.error');
682
            return $app->redirect($app->url('shopping_error'));
683
        }
684
685
        if ('POST' !== $request->getMethod()) {
686
            return $app->redirect($app->url('shopping'));
687
        }
688
689
        $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
690
691
        $event = new EventArgs(
692
            array(
693
                'builder' => $builder,
694
                'Order' => $Order,
695
            ),
696
            $request
697
        );
698
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_EDIT_CHANGE_INITIALIZE, $event);
699
700
        $form = $builder->getForm();
701
702
        $form->handleRequest($request);
703
704
        if ($form->isSubmitted() && $form->isValid()) {
705
            $data = $form->getData();
706
            $message = $data['message'];
707
            $Order->setMessage($message);
708
            // 受注情報を更新
709
            $app['orm.em']->flush();
710
711
            // お届け先設定一覧へリダイレクト
712
            return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id)));
713
        }
714
715
        return $app->render('Shopping/index.twig', array(
716
            'form' => $form->createView(),
717
            'Order' => $Order,
718
        ));
719
    }
720
721
    /**
722
     * お届け先の設定(非会員でも使用する)
@@ 1086-1128 (lines=43) @@
1083
    /**
1084
     * 複数配送処理がクリックされた場合の処理
1085
     */
1086
    public function shippingMultipleChange(Application $app, Request $request)
1087
    {
1088
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
1089
        if (!$Order) {
1090
            $app->addError('front.shopping.order.error');
1091
            return $app->redirect($app->url('shopping_error'));
1092
        }
1093
1094
        if ('POST' !== $request->getMethod()) {
1095
            return $app->redirect($app->url('shopping'));
1096
        }
1097
1098
        $builder = $app['eccube.service.shopping']->getShippingFormBuilder($Order);
1099
1100
        $event = new EventArgs(
1101
            array(
1102
                'builder' => $builder,
1103
                'Order' => $Order,
1104
            ),
1105
            $request
1106
        );
1107
        $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_MULTIPLE_CHANGE_INITIALIZE, $event);
1108
1109
        $form = $builder->getForm();
1110
1111
        $form->handleRequest($request);
1112
1113
        if ($form->isSubmitted() && $form->isValid()) {
1114
            $data = $form->getData();
1115
            $message = $data['message'];
1116
            $Order->setMessage($message);
1117
            // 受注情報を更新
1118
            $app['orm.em']->flush();
1119
1120
            // 複数配送設定へリダイレクト
1121
            return $app->redirect($app->url('shopping_shipping_multiple'));
1122
        }
1123
1124
        return $app->render('Shopping/index.twig', array(
1125
            'form' => $form->createView(),
1126
            'Order' => $Order,
1127
        ));
1128
    }
1129
1130
1131
    /**