Code Duplication    Length = 6-7 lines in 4 locations

src/wp-includes/Text/Diff/Engine/string.php 4 locations

@@ 105-111 (lines=7) @@
102
                $edits[] = new Text_Diff_Op_copy($diff1);
103
                break;
104
105
            case '+':
106
                // get all new lines
107
                do {
108
                    $diff1[] = substr($diff[$i], 1);
109
                } while (++$i < $end && substr($diff[$i], 0, 1) == '+');
110
                $edits[] = new Text_Diff_Op_add($diff1);
111
                break;
112
113
            case '-':
114
                // get changed or removed lines
@@ 209-214 (lines=6) @@
206
                    $edits[] = new Text_Diff_Op_change($diff1, $diff2);
207
                    break;
208
209
                case '+':
210
                    do {
211
                        $diff1[] = substr($diff[$i], 2);
212
                    } while (++$i < $max_i && substr($diff[$i], 0, 1) == '+');
213
                    $edits[] = new Text_Diff_Op_add($diff1);
214
                    break;
215
216
                case '-':
217
                    do {
@@ 228-233 (lines=6) @@
225
            if ($j < $max_j) {
226
                $diff2 = array();
227
                switch (substr($diff[$j], 0, 1)) {
228
                case '+':
229
                    do {
230
                        $diff2[] = substr($diff[$j++], 2);
231
                    } while ($j < $max_j && substr($diff[$j], 0, 1) == '+');
232
                    $edits[] = new Text_Diff_Op_add($diff2);
233
                    break;
234
235
                case '-':
236
                    do {
@@ 235-240 (lines=6) @@
232
                    $edits[] = new Text_Diff_Op_add($diff2);
233
                    break;
234
235
                case '-':
236
                    do {
237
                        $diff2[] = substr($diff[$j++], 2);
238
                    } while ($j < $max_j && substr($diff[$j], 0, 1) == '-');
239
                    $edits[] = new Text_Diff_Op_delete($diff2);
240
                    break;
241
                }
242
            }
243
        }