Code Duplication    Length = 23-23 lines in 2 locations

class/db.php 1 location

@@ 61-83 (lines=23) @@
58
     * @param int $id
59
     * @returns Array
60
     */
61
    public function getSchoolToDiv($id)
62
    {
63
        global $xoopsUser, $xoopsDB, $arr7;
64
        $msg    = [];
65
        $sql    = 'SELECT school_type,school,schoolstart,schoolstop FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'";
66
        $result = $xoopsDB->query($sql);
67
        while ($row = $xoopsDB->fetchArray($result)) {
68
            $school_type = unserialize($row['school_type']);
69
            $school      = unserialize($row['school']);
70
            $schoolstart = unserialize($row['schoolstart']);
71
            $schoolstop  = unserialize($row['schoolstop']);
72
        }
73
        $start = 0;
74
        $end   = count($school_type) - 1;
75
        while ($start <= $end) {
76
            $msg[$start]['school_type'] = $school_type[$start];
77
            $msg[$start]['school']      = $arr7[$school[$start]];
78
            $msg[$start]['schoolstart'] = $schoolstart[$start];
79
            $msg[$start]['schoolstop']  = $schoolstop[$start];
80
            $start++;
81
        }
82
        return $msg;
83
    }
84
85
    /**
86
     * getScreennamesToDiv function

class/SmallWorldDB.php 1 location

@@ 63-85 (lines=23) @@
60
     * @param int $id
61
     * @return array
62
     */
63
    public function getSchoolToDiv($id)
64
    {
65
        global $xoopsUser, $xoopsDB, $arr7;
66
        $msg    = [];
67
        $sql    = 'SELECT school_type,school,schoolstart,schoolstop FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'";
68
        $result = $xoopsDB->query($sql);
69
        while ($row = $xoopsDB->fetchArray($result)) {
70
            $school_type = unserialize($row['school_type']);
71
            $school      = unserialize($row['school']);
72
            $schoolstart = unserialize($row['schoolstart']);
73
            $schoolstop  = unserialize($row['schoolstop']);
74
        }
75
        $start = 0;
76
        $end   = count($school_type) - 1;
77
        while ($start <= $end) {
78
            $msg[$start]['school_type'] = $school_type[$start];
79
            $msg[$start]['school']      = $arr7[$school[$start]];
80
            $msg[$start]['schoolstart'] = $schoolstart[$start];
81
            $msg[$start]['schoolstop']  = $schoolstop[$start];
82
            $start++;
83
        }
84
        return $msg;
85
    }
86
87
    /**
88
     * getScreennamesToDiv function