Code Duplication    Length = 14-15 lines in 3 locations

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

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

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

@@ 260-273 (lines=14) @@
257
     * @Method("POST")
258
     * @Route("/product/class_category/rank/move", name="admin_product_class_category_rank_move")
259
     */
260
    public function moveRank(Application $app, Request $request)
261
    {
262
        if ($request->isXmlHttpRequest()) {
263
            $ranks = $request->request->all();
264
            foreach ($ranks as $categoryId => $rank) {
265
                $ClassCategory = $this->classCategoryRepository
266
                    ->find($categoryId);
267
                $ClassCategory->setRank($rank);
268
                $this->entityManager->persist($ClassCategory);
269
            }
270
            $this->entityManager->flush();
271
        }
272
        return true;
273
    }
274
}
275

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

@@ 172-185 (lines=14) @@
169
     * @Method("POST")
170
     * @Route("/{_admin}/product/class_name/rank/move", name="admin_product_class_name_rank_move")
171
     */
172
    public function moveRank(Application $app, Request $request)
173
    {
174
        if ($request->isXmlHttpRequest()) {
175
            $ranks = $request->request->all();
176
            foreach ($ranks as $classNameId => $rank) {
177
                $ClassName = $this->classNameRepository
178
                    ->find($classNameId);
179
                $ClassName->setRank($rank);
180
                $this->entityManager->persist($ClassName);
181
            }
182
            $this->entityManager->flush();
183
        }
184
185
        return true;
186
    }
187
}
188