Code Duplication    Length = 22-26 lines in 2 locations

src/Eccube/Controller/Mypage/ChangeController.php 1 location

@@ 67-88 (lines=22) @@
64
        $form = $builder->getForm();
65
        $form->handleRequest($request);
66
67
        if ($form->isSubmitted() && $form->isValid()) {
68
69
            if ($Customer->getPassword() === $app['config']['default_password']) {
70
                $Customer->setPassword($previous_password);
71
            } else {
72
                $Customer->setPassword(
73
                    $app['eccube.repository.customer']->encryptPassword($app, $Customer)
74
                );
75
            }
76
            $app['orm.em']->flush();
77
78
            $event = new EventArgs(
79
                array(
80
                    'form' => $form,
81
                    'Customer' => $Customer,
82
                ),
83
                $request
84
            );
85
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_MYPAGE_CHANGE_INDEX_COMPLETE, $event);
86
87
            return $app->redirect($app->url('mypage_change_complete'));
88
        }
89
90
        $app['security']->getToken()->setUser($LoginCustomer);
91

src/Eccube/Controller/ShoppingController.php 1 location

@@ 731-756 (lines=26) @@
728
729
        $form->handleRequest($request);
730
731
        if ($form->isSubmitted() && $form->isValid()) {
732
            // 会員の場合、お届け先情報を新規登録
733
            $Shipping->setFromCustomerAddress($CustomerAddress);
734
735
            if ($Customer instanceof Customer) {
736
                $app['orm.em']->persist($CustomerAddress);
737
            }
738
739
            // 配送料金の設定
740
            $app['eccube.service.shopping']->setShippingDeliveryFee($Shipping);
741
742
            // 配送先を更新
743
            $app['orm.em']->flush();
744
745
            $event = new EventArgs(
746
                array(
747
                    'form' => $form,
748
                    'Shipping' => $Shipping,
749
                    'CustomerAddress' => $CustomerAddress,
750
                ),
751
                $request
752
            );
753
            $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_SHOPPING_SHIPPING_EDIT_COMPLETE, $event);
754
755
            return $app->redirect($app->url('shopping'));
756
        }
757
758
        return $app->render('Shopping/shipping_edit.twig', array(
759
            'form' => $form->createView(),