Code Duplication    Length = 31-31 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

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