Code Duplication    Length = 10-10 lines in 4 locations

application/modules/comments/comments.php 1 location

@@ 254-263 (lines=10) @@
251
        }
252
        //}
253
254
        if (is_array($comments)) {
255
            $i = 0;
256
            foreach ($comments as $comment) {
257
                if ($comment['parent'] > 0) {
258
                    $comment_ch[] = $comment;
259
                    unset($comments[$i]);
260
                }
261
                $i++;
262
            }
263
        }
264
        //        $this->load->library('pagination');
265
        //
266
        //        $config['base_url'] = '';

application/modules/comments/commentsapi.php 3 locations

@@ 46-55 (lines=10) @@
43
44
        $comment_ch = [];
45
46
        if (is_array($comments)) {
47
            $i = 0;
48
            foreach ($comments as $comment) {
49
                if ($comment['parent'] > 0) {
50
                    $comment_ch[] = $comment;
51
                    unset($comments[$i]);
52
                }
53
                $i++;
54
            }
55
        }
56
57
        $data = [
58
                 'comments_arr'       => $comments,
@@ 103-112 (lines=10) @@
100
101
        $comment_ch = [];
102
103
        if (is_array($comments)) {
104
            $i = 0;
105
            foreach ($comments as $comment) {
106
                if ($comment['parent'] > 0) {
107
                    $comment_ch[] = $comment;
108
                    unset($comments[$i]);
109
                }
110
                $i++;
111
            }
112
        }
113
114
        $data = [
115
                 'comments_arr'       => $comments,
@@ 164-173 (lines=10) @@
161
            $comments_count = 0;
162
        }
163
164
        if (is_array($comments)) {
165
            $i = 0;
166
            foreach ($comments as $comment) {
167
                if ($comment['parent'] > 0) {
168
                    $comment_ch[] = $comment;
169
                    unset($comments[$i]);
170
                }
171
                $i++;
172
            }
173
        }
174
175
        $data = [
176
                 'comments_arr'       => $comments,