Code Duplication    Length = 26-26 lines in 2 locations

class/db.php 1 location

@@ 29-54 (lines=26) @@
26
     * @param int $id
27
     * @returns Array
28
     */
29
    public function getJobsToDiv($id)
30
    {
31
        global $xoopsUser, $xoopsDB;
32
        $msg    = [];
33
        $new    = [];
34
        $sql    = 'SELECT employer,position,jobstart,jobstop,description  FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'";
35
        $result = $xoopsDB->query($sql);
36
        while ($row = $xoopsDB->fetchArray($result)) {
37
            $employer    = unserialize($row['employer']);
38
            $position    = unserialize($row['position']);
39
            $jobstart    = unserialize($row['jobstart']);
40
            $jobstop     = unserialize($row['jobstop']);
41
            $description = unserialize($row['description']);
42
        }
43
        $start = 0;
44
        $end   = count($employer) - 1;
45
        while ($start <= $end) {
46
            $msg[$start]['employer']    = $employer[$start];
47
            $msg[$start]['position']    = $position[$start];
48
            $msg[$start]['jobstart']    = $jobstart[$start];
49
            $msg[$start]['jobstop']     = $jobstop[$start];
50
            $msg[$start]['description'] = $description[$start];
51
            ++$start;
52
        }
53
        return $msg;
54
    }
55
56
    /**
57
     * getSchoolToDiv function

class/SmallWorldDB.php 1 location

@@ 31-56 (lines=26) @@
28
     * @param int $id
29
     * @return array
30
     */
31
    public function getJobsToDiv($id)
32
    {
33
        global $xoopsUser, $xoopsDB;
34
        $msg    = [];
35
        $new    = [];
36
        $sql    = 'SELECT employer,position,jobstart,jobstop,description  FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid ='" . $id . "'";
37
        $result = $xoopsDB->query($sql);
38
        while ($row = $xoopsDB->fetchArray($result)) {
39
            $employer    = unserialize($row['employer']);
40
            $position    = unserialize($row['position']);
41
            $jobstart    = unserialize($row['jobstart']);
42
            $jobstop     = unserialize($row['jobstop']);
43
            $description = unserialize($row['description']);
44
        }
45
        $start = 0;
46
        $end   = count($employer) - 1;
47
        while ($start <= $end) {
48
            $msg[$start]['employer']    = $employer[$start];
49
            $msg[$start]['position']    = $position[$start];
50
            $msg[$start]['jobstart']    = $jobstart[$start];
51
            $msg[$start]['jobstop']     = $jobstop[$start];
52
            $msg[$start]['description'] = $description[$start];
53
            ++$start;
54
        }
55
        return $msg;
56
    }
57
58
    /**
59
     * getSchoolToDiv function