Code Duplication    Length = 21-21 lines in 2 locations

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

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