Code Duplication    Length = 10-11 lines in 2 locations

class/plugin/notifications.php 2 locations

@@ 50-60 (lines=11) @@
47
48
        global $xoopsDB;
49
50
        if ('category' === $category) {
51
52
            // Assume we have a valid topid id
53
            $sql          = 'SELECT title  FROM ' . $xoopsDB->prefix('alumni_categories') . ' WHERE cid = ' . $item_id . ' LIMIT 1';
54
            $result       = $xoopsDB->query($sql); // TODO: error check
55
            $result_array = $xoopsDB->fetchArray($result);
56
            $item['name'] = $result_array['title'];
57
            $item['url']  = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/categories.php?cid=' . $item_id;
58
59
            return $item;
60
        }
61
62
        if ('listing' === $category) {
63
            // Assume we have a valid post id
@@ 62-71 (lines=10) @@
59
            return $item;
60
        }
61
62
        if ('listing' === $category) {
63
            // Assume we have a valid post id
64
            $sql          = 'SELECT title FROM ' . $xoopsDB->prefix('alumni_listing') . ' WHERE lid = ' . $item_id . ' LIMIT 1';
65
            $result       = $xoopsDB->query($sql);
66
            $result_array = $xoopsDB->fetchArray($result);
67
            $item['name'] = $result_array['title'];
68
            $item['url']  = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/listing.php?lid= ' . $item_id;
69
70
            return $item;
71
        }
72
73
        return $item;
74
    }