Code Duplication    Length = 11-11 lines in 2 locations

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

@@ 201-211 (lines=11) @@
198
	 * @version 4.0.0
199
	 * @param string $source_id
200
	 */
201
	public static function get_order_by_source_id( $source_id ) {
202
		global $wpdb;
203
204
		$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", $source_id ) );
205
206
		if ( ! empty( $order_id ) ) {
207
			return wc_get_order( $order_id );
208
		}
209
210
		return false;
211
	}
212
213
	/**
214
	 * Gets the order by Stripe charge ID.
@@ 220-230 (lines=11) @@
217
	 * @version 4.0.0
218
	 * @param string $charge_id
219
	 */
220
	public static function get_order_by_charge_id( $charge_id ) {
221
		global $wpdb;
222
223
		$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", $charge_id ) );
224
225
		if ( ! empty( $order_id ) ) {
226
			return wc_get_order( $order_id );
227
		}
228
229
		return false;
230
	}
231
232
	/**
233
	 * Sanitize statement descriptor text.