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

@@ 1269-1285 (lines=17) @@
1266
     * @param int User id
1267
     * @return bool True if user id was found, false otherwise
1268
     */
1269
    public static function is_user_id_valid($userId)
1270
    {
1271
        $resultData = Database::select(
1272
            'COUNT(1) AS count',
1273
            Database::get_main_table(TABLE_MAIN_USER),
1274
            [
1275
                'where' => ['id = ?' => intval($userId)]
1276
            ],
1277
            'first'
1278
        );
1279
1280
        if ($resultData === false) {
1281
            return false;
1282
        }
1283
1284
        return $resultData['count'] > 0;
1285
    }
1286
1287
    /**
1288
     * Checks whether a given username matches to the specification strictly. The empty username is assumed here as invalid.