Code Duplication    Length = 17-17 lines in 2 locations

includes/api/class-give-api.php 2 locations

@@ 419-435 (lines=17) @@
416
	 *
417
	 * @return mixed|null|string
418
	 */
419
	public function get_user_public_key( $user_id = 0 ) {
420
		global $wpdb;
421
422
		if ( empty( $user_id ) ) {
423
			return '';
424
		}
425
426
		$cache_key       = md5( 'give_api_user_public_key' . $user_id );
427
		$user_public_key = Give_Cache::get( $cache_key, true );
428
429
		if ( empty( $user_public_key ) ) {
430
			$user_public_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_public_key' AND user_id = %d", $user_id ) );
431
			Give_Cache::set( $cache_key, $user_public_key, HOUR_IN_SECONDS, true );
432
		}
433
434
		return $user_public_key;
435
	}
436
437
	/**
438
	 * Get user secret key.
@@ 444-460 (lines=17) @@
441
	 *
442
	 * @return mixed|null|string
443
	 */
444
	public function get_user_secret_key( $user_id = 0 ) {
445
		global $wpdb;
446
447
		if ( empty( $user_id ) ) {
448
			return '';
449
		}
450
451
		$cache_key       = md5( 'give_api_user_secret_key' . $user_id );
452
		$user_secret_key = Give_Cache::get( $cache_key, true );
453
454
		if ( empty( $user_secret_key ) ) {
455
			$user_secret_key = $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->usermeta WHERE meta_value = 'give_user_secret_key' AND user_id = %d", $user_id ) );
456
			Give_Cache::set( $cache_key, $user_secret_key, HOUR_IN_SECONDS, true );
457
		}
458
459
		return $user_secret_key;
460
	}
461
462
	/**
463
	 * Displays a missing authentication error if all the parameters are not met.