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

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