Code Duplication    Length = 24-25 lines in 2 locations

main/inc/lib/usermanager.lib.php 2 locations

@@ 5116-5140 (lines=25) @@
5113
     * @param $userId
5114
     * @return bool
5115
     */
5116
    public static function getFirstStudentBoss($userId)
5117
    {
5118
        $userId = intval($userId);
5119
        if ($userId > 0) {
5120
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5121
            $row = Database::select(
5122
                'DISTINCT friend_user_id AS boss_id',
5123
                $userRelTable,
5124
                array(
5125
                    'where' => array(
5126
                        'user_id = ? AND relation_type = ? LIMIT 1' => array(
5127
                            $userId,
5128
                            USER_RELATION_TYPE_BOSS,
5129
                        )
5130
                    )
5131
                )
5132
            );
5133
            if (!empty($row)) {
5134
5135
                return $row[0]['boss_id'];
5136
            }
5137
        }
5138
5139
        return false;
5140
    }
5141
5142
    /**
5143
     * Get the boss user ID from a followed user id
@@ 5147-5170 (lines=24) @@
5144
     * @param $userId
5145
     * @return bool
5146
     */
5147
    public static function getStudentBossList($userId)
5148
    {
5149
        $userId = intval($userId);
5150
        if ($userId > 0) {
5151
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5152
            $result = Database::select(
5153
                'DISTINCT friend_user_id AS boss_id',
5154
                $userRelTable,
5155
                array(
5156
                    'where' => array(
5157
                        'user_id = ? AND relation_type = ? ' => array(
5158
                            $userId,
5159
                            USER_RELATION_TYPE_BOSS,
5160
                        )
5161
                    )
5162
                ),
5163
                'all'
5164
            );
5165
5166
            return $result;
5167
        }
5168
5169
        return false;
5170
    }
5171
5172
    /**
5173
     * @param int $bossId