Code Duplication    Length = 19-19 lines in 5 locations

src/Eccube/Controller/Admin/Content/NewsController.php 3 locations

@@ 114-132 (lines=19) @@
111
     * @throws NotFoundHttpException
112
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
113
     */
114
    public function up(Application $app, Request $request, $id)
115
    {
116
        $this->isTokenValid($app);
117
118
        $TargetNews = $app['eccube.repository.news']->find($id);
119
        if (!$TargetNews) {
120
            throw new NotFoundHttpException();
121
        }
122
123
        $status = $app['eccube.repository.news']->up($TargetNews);
124
125
        if ($status) {
126
            $app->addSuccess('admin.news.up.complete', 'admin');
127
        } else {
128
            $app->addError('admin.news.up.error', 'admin');
129
        }
130
131
        return $app->redirect($app->url('admin_content_news'));
132
    }
133
134
    /**
135
     * 指定した新着情報の表示順を1つ下げる。
@@ 143-161 (lines=19) @@
140
     * @throws NotFoundHttpException
141
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
142
     */
143
    public function down(Application $app, Request $request, $id)
144
    {
145
        $this->isTokenValid($app);
146
147
        $TargetNews = $app['eccube.repository.news']->find($id);
148
        if (!$TargetNews) {
149
            throw new NotFoundHttpException();
150
        }
151
152
        $status = $app['eccube.repository.news']->down($TargetNews);
153
154
        if ($status) {
155
            $app->addSuccess('admin.news.down.complete', 'admin');
156
        } else {
157
            $app->addError('admin.news.down.error', 'admin');
158
        }
159
160
        return $app->redirect($app->url('admin_content_news'));
161
    }
162
163
    /**
164
     * 指定した新着情報を削除する。
@@ 172-190 (lines=19) @@
169
     * @throws NotFoundHttpException
170
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
171
     */
172
    public function delete(Application $app, Request $request, $id)
173
    {
174
        $this->isTokenValid($app);
175
176
        $TargetNews = $app['eccube.repository.news']->find($id);
177
        if (!$TargetNews) {
178
            throw new NotFoundHttpException();
179
        }
180
181
        $status = $app['eccube.repository.news']->delete($TargetNews);
182
183
        if ($status) {
184
            $app->addSuccess('admin.news.delete.complete', 'admin');
185
        } else {
186
            $app->addSuccess('admin.news.delete.error', 'admin');
187
        }
188
189
        return $app->redirect($app->url('admin_content_news'));
190
    }
191
}

src/Eccube/Controller/Admin/Store/PluginController.php 2 locations

@@ 219-237 (lines=19) @@
216
     * @param Application $app
217
     * @param $id
218
     */
219
    public function enable(Application $app, $id)
220
    {
221
        $this->isTokenValid($app);
222
223
        $Plugin = $app['eccube.repository.plugin']->find($id);
224
225
        if (!$Plugin) {
226
            throw new NotFoundHttpException();
227
        }
228
229
        if ($Plugin->getEnable() == Constant::ENABLED) {
230
            $app->addError('admin.plugin.already.enable', 'admin');
231
        } else {
232
            $app['eccube.service.plugin']->enable($Plugin);
233
            $app->addSuccess('admin.plugin.enable.complete', 'admin');
234
        }
235
236
        return $app->redirect($app->url('admin_store_plugin'));
237
    }
238
239
    /**
240
     * 対象のプラグインを無効にします。
@@ 245-263 (lines=19) @@
242
     * @param Application $app
243
     * @param $id
244
     */
245
    public function disable(Application $app, $id)
246
    {
247
        $this->isTokenValid($app);
248
249
        $Plugin = $app['eccube.repository.plugin']->find($id);
250
251
        if (!$Plugin) {
252
            throw new NotFoundHttpException();
253
        }
254
255
        if ($Plugin->getEnable() == Constant::ENABLED) {
256
            $app['eccube.service.plugin']->disable($Plugin);
257
            $app->addSuccess('admin.plugin.disable.complete', 'admin');
258
        } else {
259
            $app->addError('admin.plugin.already.disable', 'admin');
260
        }
261
262
        return $app->redirect($app->url('admin_store_plugin'));
263
    }
264
265
266
    /**