Code Duplication    Length = 11-11 lines in 2 locations

includes/class-wc-stripe-helper.php 2 locations

@@ 396-406 (lines=11) @@
393
	 * @version 4.0.0
394
	 * @param string $source_id
395
	 */
396
	public static function get_order_by_source_id( $source_id ) {
397
		global $wpdb;
398
399
		$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s AND meta.meta_key = %s", $source_id, '_stripe_source_id' ) );
400
401
		if ( ! empty( $order_id ) ) {
402
			return wc_get_order( $order_id );
403
		}
404
405
		return false;
406
	}
407
408
	/**
409
	 * Gets the order by Stripe charge ID.
@@ 415-425 (lines=11) @@
412
	 * @version 4.0.0
413
	 * @param string $charge_id
414
	 */
415
	public static function get_order_by_charge_id( $charge_id ) {
416
		global $wpdb;
417
418
		$order_id = $wpdb->get_var( $wpdb->prepare( "SELECT DISTINCT ID FROM $wpdb->posts as posts LEFT JOIN $wpdb->postmeta as meta ON posts.ID = meta.post_id WHERE meta.meta_value = %s AND meta.meta_key = %s", $charge_id, '_transaction_id' ) );
419
420
		if ( ! empty( $order_id ) ) {
421
			return wc_get_order( $order_id );
422
		}
423
424
		return false;
425
	}
426
427
	/**
428
	 * Sanitize statement descriptor text.