Code Duplication    Length = 24-25 lines in 3 locations

src/Eccube/Controller/Admin/Content/NewsController.php 1 location

@@ 105-129 (lines=25) @@
102
103
        if ('POST' === $request->getMethod()) {
104
            $form->handleRequest($request);
105
            if ($form->isValid()) {
106
                $data = $form->getData();
107
                if (empty($data['url'])) {
108
                    $News->setLinkMethod(Constant::DISABLED);
109
                }
110
111
                $status = $app['eccube.repository.news']->save($News);
112
113
                if ($status) {
114
115
                    $event = new EventArgs(
116
                        array(
117
                            'form' => $form,
118
                            'News' => $News,
119
                        ),
120
                        $request
121
                    );
122
                    $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_CONTENT_NEWS_EDIT_COMPLETE, $event);
123
124
                    $app->addSuccess('admin.news.save.complete', 'admin');
125
126
                    return $app->redirect($app->url('admin_content_news'));
127
                }
128
                $app->addError('admin.news.save.error', 'admin');
129
            }
130
        }
131
132
        return $app->render('Content/news_edit.twig', array(

src/Eccube/Controller/Admin/Product/ClassNameController.php 1 location

@@ 61-84 (lines=24) @@
58
59
        $form = $builder->getForm();
60
61
        if ($request->getMethod() === 'POST') {
62
            $form->handleRequest($request);
63
            if ($form->isValid()) {
64
                $status = $app['eccube.repository.class_name']->save($TargetClassName);
65
66
                if ($status) {
67
68
                    $event = new EventArgs(
69
                        array(
70
                            'form' => $form,
71
                            'TargetClassName' => $TargetClassName
72
                        ),
73
                        $request
74
                    );
75
                    $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_PRODUCT_CLASS_NAME_INDEX_COMPLETE, $event);
76
77
                    $app->addSuccess('admin.class_name.save.complete', 'admin');
78
79
                    return $app->redirect($app->url('admin_product_class_name'));
80
                } else {
81
                    $app->addError('admin.class_name.save.error', 'admin');
82
                }
83
            }
84
        }
85
86
        $ClassNames = $app['eccube.repository.class_name']->getList();
87

src/Eccube/Controller/Admin/Setting/Shop/TaxRuleController.php 1 location

@@ 179-202 (lines=24) @@
176
177
        $form = $builder->getForm();
178
179
        if ('POST' === $request->getMethod()) {
180
            $form->handleRequest($request);
181
182
            // 軽減税率設定の項目のみ処理する
183
            $optionForm = $form->get('option_product_tax_rule');
184
            if ($optionForm->isValid()) {
185
                /** @var  $BaseInfo \Eccube\Entity\BaseInfo */
186
                $BaseInfo = $app['eccube.repository.base_info']->get();
187
                $BaseInfo->setOptionProductTaxRule($optionForm->getData());
188
189
                $app['orm.em']->flush();
190
191
                $event = new EventArgs(
192
                    array(
193
                        'form' => $form,
194
                        'BaseInfo' => $BaseInfo,
195
                    ),
196
                    $request
197
                );
198
                $app['eccube.event.dispatcher']->dispatch(EccubeEvents::ADMIN_SETTING_SHOP_TAX_RULE_EDIT_PARAMETER_COMPLETE, $event);
199
200
                $app->addSuccess('admin.shop.tax.save.complete', 'admin');
201
            }
202
        }
203
204
        return $app->redirect($app->url('admin_setting_shop_tax'));
205
    }