Code Duplication    Length = 14-15 lines in 3 locations

src/Eccube/Controller/Admin/Product/CategoryController.php 1 location

@@ 239-253 (lines=15) @@
236
     * @Method("POST")
237
     * @Route("/{_admin}/product/category/rank/move", name="admin_product_category_rank_move")
238
     */
239
    public function moveRank(Application $app, Request $request)
240
    {
241
        if ($request->isXmlHttpRequest()) {
242
            $ranks = $request->request->all();
243
            foreach ($ranks as $categoryId => $rank) {
244
                /* @var $Category \Eccube\Entity\Category */
245
                $Category = $this->categoryRepository
246
                    ->find($categoryId);
247
                $Category->setRank($rank);
248
                $this->entityManager->persist($Category);
249
            }
250
            $this->entityManager->flush();
251
        }
252
        return true;
253
    }
254
255
256
    /**

src/Eccube/Controller/Admin/Product/ClassNameController.php 1 location

@@ 182-195 (lines=14) @@
179
     * @Method("POST")
180
     * @Route("/{_admin}/product/class_name/rank/move", name="admin_product_class_name_rank_move")
181
     */
182
    public function moveRank(Application $app, Request $request)
183
    {
184
        if ($request->isXmlHttpRequest()) {
185
            $ranks = $request->request->all();
186
            foreach ($ranks as $classNameId => $rank) {
187
                $ClassName = $this->classNameRepository
188
                    ->find($classNameId);
189
                $ClassName->setRank($rank);
190
                $this->entityManager->persist($ClassName);
191
            }
192
            $this->entityManager->flush();
193
        }
194
        return true;
195
    }
196
}
197

src/Eccube/Controller/Admin/Product/ClassCategoryController.php 1 location

@@ 272-285 (lines=14) @@
269
     * @Method("POST")
270
     * @Route("/product/class_category/rank/move", name="admin_product_class_category_rank_move")
271
     */
272
    public function moveRank(Application $app, Request $request)
273
    {
274
        if ($request->isXmlHttpRequest()) {
275
            $ranks = $request->request->all();
276
            foreach ($ranks as $categoryId => $rank) {
277
                $ClassCategory = $this->classCategoryRepository
278
                    ->find($categoryId);
279
                $ClassCategory->setRank($rank);
280
                $this->entityManager->persist($ClassCategory);
281
            }
282
            $this->entityManager->flush();
283
        }
284
        return true;
285
    }
286
}
287