Code Duplication    Length = 17-17 lines in 2 locations

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

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

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