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

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