Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 1180-1196 (lines=17) @@
1177
     * @param int User id
1178
     * @return bool True if user id was found, false otherwise
1179
     */
1180
    public static function is_user_id_valid($userId)
1181
    {
1182
        $resultData = Database::select(
1183
            'COUNT(1) AS count',
1184
            Database::get_main_table(TABLE_MAIN_USER),
1185
            [
1186
                'where' => ['id = ?' => intval($userId)]
1187
            ],
1188
            'first'
1189
        );
1190
1191
        if ($resultData === false) {
1192
            return false;
1193
        }
1194
1195
        return $resultData['count'] > 0;
1196
    }
1197
1198
    /**
1199
     * Checks whether a given username matches to the specification strictly. The empty username is assumed here as invalid.

main/inc/lib/VideoChat.php 1 location

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