Code Duplication    Length = 21-21 lines in 2 locations

src/Eccube/Controller/Admin/Setting/Shop/PaymentController.php 2 locations

@@ 241-261 (lines=21) @@
238
     * @Method("PUT")
239
     * @Route("/%eccube_admin_route%/setting/shop/payment/{id}/up", requirements={"id" = "\d+"}, name="admin_setting_shop_payment_up")
240
     */
241
    public function up(Payment $current)
242
    {
243
        $this->isTokenValid();
244
245
        $currentSortNo = $current->getSortNo();
246
        $targetSortNo = $currentSortNo + 1;
247
248
        $target = $this->paymentRepository->findOneBy(['sort_no' => $targetSortNo]);
249
250
        if ($target) {
251
            $this->entityManager->persist($target->setSortNo($currentSortNo));
252
            $this->entityManager->persist($current->setSortNo($targetSortNo));
253
            $this->entityManager->flush();
254
255
            $this->addSuccess('admin.sort_no.move.complete', 'admin');
256
        } else {
257
            $this->addError('admin.sort_no.up.error', 'admin');
258
        }
259
260
        return $this->redirectToRoute('admin_setting_shop_payment');
261
    }
262
263
    /**
264
     * @Method("PUT")
@@ 267-287 (lines=21) @@
264
     * @Method("PUT")
265
     * @Route("/%eccube_admin_route%/setting/shop/payment/{id}/down", requirements={"id" = "\d+"}, name="admin_setting_shop_payment_down")
266
     */
267
    public function down(Payment $current)
268
    {
269
        $this->isTokenValid();
270
271
        $currentSortNo = $current->getSortNo();
272
        $targetSortNo = $currentSortNo - 1;
273
274
        $target = $this->paymentRepository->findOneBy(['sort_no' => $targetSortNo]);
275
276
        if ($target) {
277
            $this->entityManager->persist($target->setSortNo($currentSortNo));
278
            $this->entityManager->persist($current->setSortNo($targetSortNo));
279
            $this->entityManager->flush();
280
281
            $this->addSuccess('admin.sort_no.move.complete', 'admin');
282
        } else {
283
            $this->addError('admin.sort_no.down.error', 'admin');
284
        }
285
286
        return $this->redirectToRoute('admin_setting_shop_payment');
287
    }
288
289
    /**
290
     * @Method("PUT")