Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 5348-5372 (lines=25) @@
5345
     * @param $userId
5346
     * @return bool
5347
     */
5348
    public static function getFirstStudentBoss($userId)
5349
    {
5350
        $userId = intval($userId);
5351
        if ($userId > 0) {
5352
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5353
            $row = Database::select(
5354
                'DISTINCT friend_user_id AS boss_id',
5355
                $userRelTable,
5356
                array(
5357
                    'where' => array(
5358
                        'user_id = ? AND relation_type = ? LIMIT 1' => array(
5359
                            $userId,
5360
                            USER_RELATION_TYPE_BOSS,
5361
                        )
5362
                    )
5363
                )
5364
            );
5365
            if (!empty($row)) {
5366
5367
                return $row[0]['boss_id'];
5368
            }
5369
        }
5370
5371
        return false;
5372
    }
5373
5374
    /**
5375
     * Get the boss user ID from a followed user id
@@ 5379-5402 (lines=24) @@
5376
     * @param $userId
5377
     * @return bool
5378
     */
5379
    public static function getStudentBossList($userId)
5380
    {
5381
        $userId = intval($userId);
5382
        if ($userId > 0) {
5383
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5384
            $result = Database::select(
5385
                'DISTINCT friend_user_id AS boss_id',
5386
                $userRelTable,
5387
                array(
5388
                    'where' => array(
5389
                        'user_id = ? AND relation_type = ? ' => array(
5390
                            $userId,
5391
                            USER_RELATION_TYPE_BOSS,
5392
                        )
5393
                    )
5394
                ),
5395
                'all'
5396
            );
5397
5398
            return $result;
5399
        }
5400
5401
        return false;
5402
    }
5403
5404
    /**
5405
     * @param int $bossId