Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 5319-5343 (lines=25) @@
5316
     * @param $userId
5317
     * @return bool
5318
     */
5319
    public static function getFirstStudentBoss($userId)
5320
    {
5321
        $userId = intval($userId);
5322
        if ($userId > 0) {
5323
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5324
            $row = Database::select(
5325
                'DISTINCT friend_user_id AS boss_id',
5326
                $userRelTable,
5327
                array(
5328
                    'where' => array(
5329
                        'user_id = ? AND relation_type = ? LIMIT 1' => array(
5330
                            $userId,
5331
                            USER_RELATION_TYPE_BOSS,
5332
                        )
5333
                    )
5334
                )
5335
            );
5336
            if (!empty($row)) {
5337
5338
                return $row[0]['boss_id'];
5339
            }
5340
        }
5341
5342
        return false;
5343
    }
5344
5345
    /**
5346
     * Get the boss user ID from a followed user id
@@ 5350-5373 (lines=24) @@
5347
     * @param $userId
5348
     * @return bool
5349
     */
5350
    public static function getStudentBossList($userId)
5351
    {
5352
        $userId = intval($userId);
5353
        if ($userId > 0) {
5354
            $userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
5355
            $result = Database::select(
5356
                'DISTINCT friend_user_id AS boss_id',
5357
                $userRelTable,
5358
                array(
5359
                    'where' => array(
5360
                        'user_id = ? AND relation_type = ? ' => array(
5361
                            $userId,
5362
                            USER_RELATION_TYPE_BOSS,
5363
                        )
5364
                    )
5365
                ),
5366
                'all'
5367
            );
5368
5369
            return $result;
5370
        }
5371
5372
        return false;
5373
    }
5374
5375
    /**
5376
     * @param int $bossId