Code Duplication    Length = 14-15 lines in 4 locations

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

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

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

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

@@ 161-174 (lines=14) @@
158
        return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
159
    }
160
161
    public function moveRank(Application $app, Request $request)
162
    {
163
        if ($request->isXmlHttpRequest()) {
164
            $ranks = $request->request->all();
165
            foreach ($ranks as $categoryId => $rank) {
166
                $ClassCategory = $app['eccube.repository.class_category']
167
                    ->find($categoryId);
168
                $ClassCategory->setRank($rank);
169
                $app['orm.em']->persist($ClassCategory);
170
            }
171
            $app['orm.em']->flush();
172
        }
173
        return true;
174
    }
175
}
176

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

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