Code Duplication    Length = 15-16 lines in 2 locations

class/Admin.php 2 locations

@@ 145-160 (lines=16) @@
142
        $result  = $xoopsDB->queryF($sql);
143
        $counter = $xoopsDB->getRowsNum($result);
144
145
        if ($counter < 1) {
146
            $msg = [];
147
        } else {
148
            $msg = [];
149
            $i   = 1;
150
            while ($row = $xoopsDB->fetchArray($result)) {
151
                $msg['counter'][$i] = $i;
152
                $msg['img'][$i]     = "<img style='margin:0px 5px;' src = '../assets/images/" . $i . ".png'>";
153
                if ($msg['counter'][$i] > 3) {
154
                    $msg['img'][$i] = '';
155
                }
156
                $msg['cnt'][$i]  = $row['cnt'];
157
                $msg['from'][$i] = $xoopsUser->getUnameFromId($row['uid_fk']);
158
                ++$i;
159
            }
160
        }
161
162
        return $msg;
163
    }
@@ 187-201 (lines=15) @@
184
        $result   = $xoopsDB->queryF($sql);
185
        $msgtoday = [];
186
187
        if (0 != $xoopsDB->getRowsNum($result)) {
188
            $i = 1;
189
            while ($row = $xoopsDB->fetchArray($result)) {
190
                $msgtoday['counter'][$i] = $i;
191
                $msgtoday['img'][$i]     = "<img style='margin:0px 5px;' src = '../assets/images/" . $i . ".png'>";
192
                if ($msgtoday['counter'][$i] > 3) {
193
                    $msgtoday['img'][$i] = '';
194
                }
195
                $msgtoday['cnt'][$i]  = $row['cnt'];
196
                $msgtoday['from'][$i] = $xoopsUser->getUnameFromId($row['uid_fk']);
197
                ++$i;
198
            }
199
        } else {
200
            $msgtoday = [];
201
        }
202
203
        return $msgtoday;
204
    }