Code Duplication    Length = 17-17 lines in 2 locations

main/inc/lib/VideoChat.php 1 location

@@ 74-90 (lines=17) @@
71
     *
72
     * @return boolean
73
     */
74
    public static function nameExists($name)
75
    {
76
        $resultData = Database::select(
77
            'COUNT(1) AS count',
78
            Database::get_main_table(TABLE_MAIN_CHAT_VIDEO),
79
            [
80
                'where' => ['room_name = ?' => $name]
81
            ],
82
            'first'
83
        );
84
85
        if ($resultData !== false) {
86
            return $resultData['count'] > 0;
87
        }
88
89
        return false;
90
    }
91
}
92

main/inc/lib/usermanager.lib.php 1 location

@@ 1356-1372 (lines=17) @@
1353
     * @param int User id
1354
     * @return bool True if user id was found, false otherwise
1355
     */
1356
    public static function is_user_id_valid($userId)
1357
    {
1358
        $resultData = Database::select(
1359
            'COUNT(1) AS count',
1360
            Database::get_main_table(TABLE_MAIN_USER),
1361
            [
1362
                'where' => ['id = ?' => intval($userId)]
1363
            ],
1364
            'first'
1365
        );
1366
1367
        if ($resultData === false) {
1368
            return false;
1369
        }
1370
1371
        return $resultData['count'] > 0;
1372
    }
1373
1374
    /**
1375
     * Checks whether a given username matches to the specification strictly. The empty username is assumed here as invalid.