Code Duplication    Length = 10-10 lines in 2 locations

main/survey/survey_question.php 2 locations

@@ 188-197 (lines=10) @@
185
        }
186
187
        // Moving an answer up
188
        if (isset($_POST['move_up']) && $_POST['move_up']) {
189
            foreach ($_POST['move_up'] as $key => & $value) {
190
                $id1 = $key;
191
                $content1 = $formData['answers'][$id1];
192
                $id2 = $key - 1;
193
                $content2 = $formData['answers'][$id2];
194
                $formData['answers'][$id1] = $content2;
195
                $formData['answers'][$id2] = $content1;
196
            }
197
        }
198
199
        // Moving an answer down
200
        if (isset($_POST['move_down']) && $_POST['move_down']) {
@@ 200-209 (lines=10) @@
197
        }
198
199
        // Moving an answer down
200
        if (isset($_POST['move_down']) && $_POST['move_down']) {
201
            foreach ($_POST['move_down'] as $key => & $value) {
202
                $id1 = $key;
203
                $content1 = $formData['answers'][$id1];
204
                $id2 = $key + 1;
205
                $content2 = $formData['answers'][$id2];
206
                $formData['answers'][$id1] = $content2;
207
                $formData['answers'][$id2] = $content1;
208
            }
209
        }
210
211
        /**
212
         * This solution is a little bit strange but I could not find a different solution.