Code Duplication    Length = 13-13 lines in 2 locations

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

@@ 451-463 (lines=13) @@
448
		$stripe_customer_id = get_post_meta( $subscription->get_id(), '_stripe_customer_id', true );
449
450
		// If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data.
451
		if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) {
452
			$user_id            = $customer_user;
453
			$stripe_customer_id = get_user_option( '_stripe_customer_id', $user_id );
454
			$stripe_source_id   = get_user_option( '_stripe_source_id', $user_id );
455
456
			// For BW compat will remove in future.
457
			if ( empty( $stripe_source_id ) ) {
458
				$stripe_source_id = get_user_option( '_stripe_card_id', $user_id );
459
460
				// Take this opportunity to update the key name.
461
				update_user_option( $user_id, '_stripe_source_id', $stripe_source_id, false );
462
			}
463
		}
464
465
		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
466
		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {

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

@@ 560-572 (lines=13) @@
557
		$stripe_customer_id = get_post_meta( $subscription->get_id(), '_stripe_customer_id', true );
558
559
		// If we couldn't find a Stripe customer linked to the subscription, fallback to the user meta data.
560
		if ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) {
561
			$user_id            = $customer_user;
562
			$stripe_customer_id = get_user_option( '_stripe_customer_id', $user_id );
563
			$stripe_source_id   = get_user_option( '_stripe_source_id', $user_id );
564
565
			// For BW compat will remove in future.
566
			if ( empty( $stripe_source_id ) ) {
567
				$stripe_source_id = get_user_option( '_stripe_card_id', $user_id );
568
569
				// Take this opportunity to update the key name.
570
				update_user_option( $user_id, '_stripe_source_id', $stripe_source_id, false );
571
			}
572
		}
573
574
		// If we couldn't find a Stripe customer linked to the account, fallback to the order meta data.
575
		if ( ( ! $stripe_customer_id || ! is_string( $stripe_customer_id ) ) && false !== $subscription->order ) {