Code Duplication    Length = 14-15 lines in 4 locations

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

@@ 133-147 (lines=15) @@
130
        }
131
    }
132
133
    public function moveRank(Application $app, Request $request)
134
    {
135
        if ($request->isXmlHttpRequest()) {
136
            $ranks = $request->request->all();
137
            foreach ($ranks as $categoryId => $rank) {
138
                /* @var $Category \Eccube\Entity\Category */
139
                $Category = $app['eccube.repository.category']
140
                    ->find($categoryId);
141
                $Category->setRank($rank);
142
                $app['orm.em']->persist($Category);
143
            }
144
            $app['orm.em']->flush();
145
        }
146
        return true;
147
    }
148
149
150
    /**

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

@@ 116-129 (lines=14) @@
113
        return $app->redirect($app->url('admin_product_class_category', array('class_name_id' => $ClassName->getId())));
114
    }
115
116
    public function moveRank(Application $app, Request $request)
117
    {
118
        if ($request->isXmlHttpRequest()) {
119
            $ranks = $request->request->all();
120
            foreach ($ranks as $categoryId => $rank) {
121
                $ClassCategory = $app['eccube.repository.class_category']
122
                    ->find($categoryId);
123
                $ClassCategory->setRank($rank);
124
                $app['orm.em']->persist($ClassCategory);
125
            }
126
            $app['orm.em']->flush();
127
        }
128
        return true;
129
    }
130
}
131

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

@@ 94-107 (lines=14) @@
91
        return $app->redirect($app->url('admin_product_class_name'));
92
    }
93
94
    public function moveRank(Application $app, Request $request)
95
    {
96
        if ($request->isXmlHttpRequest()) {
97
            $ranks = $request->request->all();
98
            foreach ($ranks as $classNameId => $rank) {
99
                $ClassName = $app['eccube.repository.class_name']
100
                    ->find($classNameId);
101
                $ClassName->setRank($rank);
102
                $app['orm.em']->persist($ClassName);
103
            }
104
            $app['orm.em']->flush();
105
        }
106
        return true;
107
    }
108
}
109

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

@@ 200-214 (lines=15) @@
197
        return $app->redirect($app->url('admin_setting_shop_delivery'));
198
    }
199
200
    public function moveRank(Application $app, Request $request)
201
    {
202
        if ($request->isXmlHttpRequest()) {
203
            $ranks = $request->request->all();
204
            foreach ($ranks as $deliveryId => $rank) {
205
                $Delivery = $app['eccube.repository.delivery']
206
                    ->find($deliveryId);
207
                $Delivery->setRank($rank);
208
                $app['orm.em']->persist($Delivery);
209
            }
210
            $app['orm.em']->flush();
211
        }
212
213
        return true;
214
    }
215
}
216