Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 5295-5319 (lines=25) @@
5292
     * @param $userId
5293
     * @return bool
5294
     */
5295
    public static function getFirstStudentBoss($userId)
5296
    {
5297
        $userId = intval($userId);
5298
        if ($userId > 0) {
5299
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5300
            $row = Database::select(
5301
                'DISTINCT friend_user_id AS boss_id',
5302
                $userRelTable,
5303
                array(
5304
                    'where' => array(
5305
                        'user_id = ? AND relation_type = ? LIMIT 1' => array(
5306
                            $userId,
5307
                            USER_RELATION_TYPE_BOSS,
5308
                        )
5309
                    )
5310
                )
5311
            );
5312
            if (!empty($row)) {
5313
5314
                return $row[0]['boss_id'];
5315
            }
5316
        }
5317
5318
        return false;
5319
    }
5320
5321
    /**
5322
     * Get the boss user ID from a followed user id
@@ 5326-5349 (lines=24) @@
5323
     * @param $userId
5324
     * @return bool
5325
     */
5326
    public static function getStudentBossList($userId)
5327
    {
5328
        $userId = intval($userId);
5329
        if ($userId > 0) {
5330
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5331
            $result = Database::select(
5332
                'DISTINCT friend_user_id AS boss_id',
5333
                $userRelTable,
5334
                array(
5335
                    'where' => array(
5336
                        'user_id = ? AND relation_type = ? ' => array(
5337
                            $userId,
5338
                            USER_RELATION_TYPE_BOSS,
5339
                        )
5340
                    )
5341
                ),
5342
                'all'
5343
            );
5344
5345
            return $result;
5346
        }
5347
5348
        return false;
5349
    }
5350
5351
    /**
5352
     * @param int $bossId