Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 5011-5035 (lines=25) @@
5008
     * @param $userId
5009
     * @return bool
5010
     */
5011
    public static function getFirstStudentBoss($userId)
5012
    {
5013
        $userId = intval($userId);
5014
        if ($userId > 0) {
5015
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5016
            $row = Database::select(
5017
                'DISTINCT friend_user_id AS boss_id',
5018
                $userRelTable,
5019
                array(
5020
                    'where' => array(
5021
                        'user_id = ? AND relation_type = ? LIMIT 1' => array(
5022
                            $userId,
5023
                            USER_RELATION_TYPE_BOSS,
5024
                        )
5025
                    )
5026
                )
5027
            );
5028
            if (!empty($row)) {
5029
5030
                return $row[0]['boss_id'];
5031
            }
5032
        }
5033
5034
        return false;
5035
    }
5036
5037
    /**
5038
     * Get the boss user ID from a followed user id
@@ 5042-5065 (lines=24) @@
5039
     * @param $userId
5040
     * @return bool
5041
     */
5042
    public static function getStudentBossList($userId)
5043
    {
5044
        $userId = intval($userId);
5045
        if ($userId > 0) {
5046
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5047
            $result = Database::select(
5048
                'DISTINCT friend_user_id AS boss_id',
5049
                $userRelTable,
5050
                array(
5051
                    'where' => array(
5052
                        'user_id = ? AND relation_type = ? ' => array(
5053
                            $userId,
5054
                            USER_RELATION_TYPE_BOSS,
5055
                        )
5056
                    )
5057
                ),
5058
                'all'
5059
            );
5060
5061
            return $result;
5062
        }
5063
5064
        return false;
5065
    }
5066
5067
    /**
5068
     * Get either a Gravatar URL or complete image tag for a specified email address.