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

@@ 1283-1299 (lines=17) @@
1280
     * @param int User id
1281
     * @return bool True if user id was found, false otherwise
1282
     */
1283
    public static function is_user_id_valid($userId)
1284
    {
1285
        $resultData = Database::select(
1286
            'COUNT(1) AS count',
1287
            Database::get_main_table(TABLE_MAIN_USER),
1288
            [
1289
                'where' => ['id = ?' => intval($userId)]
1290
            ],
1291
            'first'
1292
        );
1293
1294
        if ($resultData === false) {
1295
            return false;
1296
        }
1297
1298
        return $resultData['count'] > 0;
1299
    }
1300
1301
    /**
1302
     * Checks whether a given username matches to the specification strictly. The empty username is assumed here as invalid.