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

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