Code Duplication    Length = 19-19 lines in 4 locations

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

@@ 147-165 (lines=19) @@
144
     * @throws NotFoundHttpException
145
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
146
     */
147
    public function up(Application $app, Request $request, $id)
148
    {
149
        $this->isTokenValid($app);
150
151
        $TargetNews = $app['eccube.repository.news']->find($id);
152
        if (!$TargetNews) {
153
            throw new NotFoundHttpException();
154
        }
155
156
        $status = $app['eccube.repository.news']->up($TargetNews);
157
158
        if ($status) {
159
            $app->addSuccess('admin.news.up.complete', 'admin');
160
        } else {
161
            $app->addError('admin.news.up.error', 'admin');
162
        }
163
164
        return $app->redirect($app->url('admin_content_news'));
165
    }
166
167
    /**
168
     * 指定した新着情報の表示順を1つ下げる。
@@ 176-194 (lines=19) @@
173
     * @throws NotFoundHttpException
174
     * @return \Symfony\Component\HttpFoundation\RedirectResponse
175
     */
176
    public function down(Application $app, Request $request, $id)
177
    {
178
        $this->isTokenValid($app);
179
180
        $TargetNews = $app['eccube.repository.news']->find($id);
181
        if (!$TargetNews) {
182
            throw new NotFoundHttpException();
183
        }
184
185
        $status = $app['eccube.repository.news']->down($TargetNews);
186
187
        if ($status) {
188
            $app->addSuccess('admin.news.down.complete', 'admin');
189
        } else {
190
            $app->addError('admin.news.down.error', 'admin');
191
        }
192
193
        return $app->redirect($app->url('admin_content_news'));
194
    }
195
196
    /**
197
     * 指定した新着情報を削除する。

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

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