Code Duplication    Length = 21-21 lines in 2 locations

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

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