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

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