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
     * お届け先の設定(非会員でも使用する)
@@ 765-795 (lines=31) @@
762
    /**
763
     * 複数配送処理がクリックされた場合の処理
764
     */
765
    public function shippingMultipleChange(Application $app, Request $request)
766
    {
767
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
768
        if (!$Order) {
769
            $app->addError('front.shopping.order.error');
770
            return $app->redirect($app->url('shopping_error'));
771
        }
772
773
        if ('POST' !== $request->getMethod()) {
774
            return $app->redirect($app->url('shopping'));
775
        }
776
777
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
778
        $form->handleRequest($request);
779
780
        if ($form->isSubmitted() && $form->isValid()) {
781
            $data = $form->getData();
782
            $message = $data['message'];
783
            $Order->setMessage($message);
784
            // 受注情報を更新
785
            $app['orm.em']->flush();
786
787
            // 複数配送設定へリダイレクト
788
            return $app->redirect($app->url('shopping_shipping_multiple'));
789
        }
790
791
        return $app->render('Shopping/index.twig', array(
792
            'form' => $form->createView(),
793
            'Order' => $Order,
794
        ));
795
    }
796
797
798
    /**