Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 109-123 (lines=15) @@
106
	 * @param string $source_id
107
	 * @param object $source_object
108
	 */
109
	public function handle_add_payment_method_success( $source_id, $source_object ) {
110
		if ( isset( $_POST['wc-' . $this->id . '-update-subs-payment-method-card'] ) ) {
111
			$all_subs = wcs_get_users_subscriptions();
112
113
			if ( ! empty( $all_subs ) ) {
114
				foreach ( $all_subs as $sub ) {
115
					if ( 'active' === $sub->get_status() ) {
116
						update_post_meta( $sub->get_id(), '_stripe_source_id', $source_id );
117
						update_post_meta( $sub->get_id(), '_payment_method', $this->id );
118
						update_post_meta( $sub->get_id(), '_payment_method_title', $this->method_title );
119
					}
120
				}
121
			}
122
		}
123
	}
124
125
	/**
126
	 * Updates other subscription sources.

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

@@ 109-123 (lines=15) @@
106
	 * @param string $source_id
107
	 * @param object $source_object
108
	 */
109
	public function handle_add_payment_method_success( $source_id, $source_object ) {
110
		if ( isset( $_POST['wc-' . $this->id . '-update-subs-payment-method-card'] ) ) {
111
			$all_subs = wcs_get_users_subscriptions();
112
113
			if ( ! empty( $all_subs ) ) {
114
				foreach ( $all_subs as $sub ) {
115
					if ( 'active' === $sub->get_status() ) {
116
						update_post_meta( $sub->get_id(), '_stripe_source_id', $source_id );
117
						update_post_meta( $sub->get_id(), '_payment_method', $this->id );
118
						update_post_meta( $sub->get_id(), '_payment_method_title', $this->method_title );
119
					}
120
				}
121
			}
122
		}
123
	}
124
125
	/**
126
	 * Process the payment method change for subscriptions.