Code Duplication    Length = 12-12 lines in 2 locations

includes/compat/class-wc-stripe-sepa-subs-compat.php 1 location

@@ 382-393 (lines=12) @@
379
		}
380
381
		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
382
		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
383
			$stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_customer_id', true );
384
			$stripe_source_id   = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_source_id', true );
385
386
			// For BW compat will remove in future.
387
			if ( empty( $stripe_source_id ) ) {
388
				$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_card_id', true );
389
390
				// Take this opportunity to update the key name.
391
				WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->order->id, '_stripe_source_id', $stripe_source_id ) : update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id );
392
			}
393
		}
394
395
		$stripe_customer->set_id( $stripe_customer_id );
396
		$sources = $stripe_customer->get_sources();

includes/compat/class-wc-stripe-subs-compat.php 1 location

@@ 454-465 (lines=12) @@
451
		}
452
453
		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
454
		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {
455
			$stripe_customer_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_customer_id', true );
456
			$stripe_source_id   = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_source_id', true );
457
458
			// For BW compat will remove in future.
459
			if ( empty( $stripe_source_id ) ) {
460
				$stripe_source_id = get_post_meta( ( WC_Stripe_Helper::is_pre_30() ? $subscription->order->id : $subscription->get_parent_id() ), '_stripe_card_id', true );
461
462
				// Take this opportunity to update the key name.
463
				WC_Stripe_Helper::is_pre_30() ? update_post_meta( $subscription->order->id, '_stripe_source_id', $stripe_source_id ) : update_post_meta( $subscription->get_parent_id(), '_stripe_source_id', $stripe_source_id );
464
			}
465
		}
466
467
		$stripe_customer->set_id( $stripe_customer_id );
468
		$sources = $stripe_customer->get_sources();