Code Duplication    Length = 14-15 lines in 4 locations

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

@@ 167-181 (lines=15) @@
164
        }
165
    }
166
167
    public function moveRank(Application $app, Request $request)
168
    {
169
        if ($request->isXmlHttpRequest()) {
170
            $ranks = $request->request->all();
171
            foreach ($ranks as $categoryId => $rank) {
172
                /* @var $Category \Eccube\Entity\Category */
173
                $Category = $app['eccube.repository.category']
174
                    ->find($categoryId);
175
                $Category->setRank($rank);
176
                $app['orm.em']->persist($Category);
177
            }
178
            $app['orm.em']->flush();
179
        }
180
        return true;
181
    }
182
183
184
    /**

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

@@ 150-163 (lines=14) @@
147
        return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
148
    }
149
150
    public function moveRank(Application $app, Request $request)
151
    {
152
        if ($request->isXmlHttpRequest()) {
153
            $ranks = $request->request->all();
154
            foreach ($ranks as $categoryId => $rank) {
155
                $ClassCategory = $app['eccube.repository.class_category']
156
                    ->find($categoryId);
157
                $ClassCategory->setRank($rank);
158
                $app['orm.em']->persist($ClassCategory);
159
            }
160
            $app['orm.em']->flush();
161
        }
162
        return true;
163
    }
164
}
165

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

@@ 125-138 (lines=14) @@
122
        return $app->redirect($app->url('admin_product_class_name'));
123
    }
124
125
    public function moveRank(Application $app, Request $request)
126
    {
127
        if ($request->isXmlHttpRequest()) {
128
            $ranks = $request->request->all();
129
            foreach ($ranks as $classNameId => $rank) {
130
                $ClassName = $app['eccube.repository.class_name']
131
                    ->find($classNameId);
132
                $ClassName->setRank($rank);
133
                $app['orm.em']->persist($ClassName);
134
            }
135
            $app['orm.em']->flush();
136
        }
137
        return true;
138
    }
139
}
140

src/Eccube/Controller/Admin/Setting/Shop/DeliveryController.php 1 location

@@ 244-258 (lines=15) @@
241
        return $app->redirect($app->url('admin_setting_shop_delivery'));
242
    }
243
244
    public function moveRank(Application $app, Request $request)
245
    {
246
        if ($request->isXmlHttpRequest()) {
247
            $ranks = $request->request->all();
248
            foreach ($ranks as $deliveryId => $rank) {
249
                $Delivery = $app['eccube.repository.delivery']
250
                    ->find($deliveryId);
251
                $Delivery->setRank($rank);
252
                $app['orm.em']->persist($Delivery);
253
            }
254
            $app['orm.em']->flush();
255
        }
256
257
        return true;
258
    }
259
}
260