Code Duplication    Length = 31-31 lines in 3 locations

src/Eccube/Controller/ShoppingController.php 3 locations

@@ 389-419 (lines=31) @@
386
    /**
387
     * お届け先変更がクリックされた場合の処理
388
     */
389
    public function shippingChange(Application $app, Request $request, $id)
390
    {
391
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
392
        if (!$Order) {
393
            $app->addError('front.shopping.order.error');
394
            return $app->redirect($app->url('shopping_error'));
395
        }
396
397
        if ('POST' !== $request->getMethod()) {
398
            return $app->redirect($app->url('shopping'));
399
        }
400
401
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
402
        $form->handleRequest($request);
403
404
        if ($form->isSubmitted() && $form->isValid()) {
405
            $data = $form->getData();
406
            $message = $data['message'];
407
            $Order->setMessage($message);
408
            // 受注情報を更新
409
            $app['orm.em']->flush();
410
411
            // お届け先設定一覧へリダイレクト
412
            return $app->redirect($app->url('shopping_shipping', array('id' => $id)));
413
        }
414
415
        return $app->render('Shopping/index.twig', array(
416
            'form' => $form->createView(),
417
            'Order' => $Order,
418
        ));
419
    }
420
421
    /**
422
     * お届け先の設定一覧からの選択
@@ 494-524 (lines=31) @@
491
    /**
492
     * お届け先の設定(非会員)がクリックされた場合の処理
493
     */
494
    public function shippingEditChange(Application $app, Request $request, $id)
495
    {
496
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
497
        if (!$Order) {
498
            $app->addError('front.shopping.order.error');
499
            return $app->redirect($app->url('shopping_error'));
500
        }
501
502
        if ('POST' !== $request->getMethod()) {
503
            return $app->redirect($app->url('shopping'));
504
        }
505
506
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
507
        $form->handleRequest($request);
508
509
        if ($form->isSubmitted() && $form->isValid()) {
510
            $data = $form->getData();
511
            $message = $data['message'];
512
            $Order->setMessage($message);
513
            // 受注情報を更新
514
            $app['orm.em']->flush();
515
516
            // お届け先設定一覧へリダイレクト
517
            return $app->redirect($app->url('shopping_shipping_edit', array('id' => $id)));
518
        }
519
520
        return $app->render('Shopping/index.twig', array(
521
            'form' => $form->createView(),
522
            'Order' => $Order,
523
        ));
524
    }
525
526
    /**
527
     * お届け先の設定(非会員でも使用する)
@@ 797-827 (lines=31) @@
794
    /**
795
     * 複数配送処理がクリックされた場合の処理
796
     */
797
    public function shippingMultipleChange(Application $app, Request $request)
798
    {
799
        $Order = $app['eccube.service.shopping']->getOrder($app['config']['order_processing']);
800
        if (!$Order) {
801
            $app->addError('front.shopping.order.error');
802
            return $app->redirect($app->url('shopping_error'));
803
        }
804
805
        if ('POST' !== $request->getMethod()) {
806
            return $app->redirect($app->url('shopping'));
807
        }
808
809
        $form = $app['eccube.service.shopping']->getShippingForm($Order);
810
        $form->handleRequest($request);
811
812
        if ($form->isSubmitted() && $form->isValid()) {
813
            $data = $form->getData();
814
            $message = $data['message'];
815
            $Order->setMessage($message);
816
            // 受注情報を更新
817
            $app['orm.em']->flush();
818
819
            // 複数配送設定へリダイレクト
820
            return $app->redirect($app->url('shopping_shipping_multiple'));
821
        }
822
823
        return $app->render('Shopping/index.twig', array(
824
            'form' => $form->createView(),
825
            'Order' => $Order,
826
        ));
827
    }
828
829
830
    /**