Code Duplication    Length = 19-19 lines in 2 locations

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

@@ 76-94 (lines=19) @@
73
	 *
74
	 * @since 4.1.11
75
	 */
76
	public function display_update_subs_payment_checkout() {
77
		$subs_statuses = apply_filters( 'wc_stripe_update_subs_payment_method_card_statuses', array( 'active' ) );
78
		if (
79
			apply_filters( 'wc_stripe_display_update_subs_payment_method_card_checkbox', true ) &&
80
			wcs_user_has_subscription( get_current_user_id(), '', $subs_statuses ) &&
81
			is_add_payment_method_page()
82
		) {
83
			$label = esc_html( apply_filters( 'wc_stripe_save_to_subs_text', __( 'Update the Payment Method used for all of my active subscriptions.', 'woocommerce-gateway-stripe' ) ) );
84
			$id    = sprintf( 'wc-%1$s-update-subs-payment-method-card', $this->id );
85
			woocommerce_form_field(
86
				$id,
87
				array(
88
					'type'    => 'checkbox',
89
					'label'   => $label,
90
					'default' => apply_filters( 'wc_stripe_save_to_subs_checked', false ),
91
				)
92
			);
93
		}
94
	}
95
96
	/**
97
	 * Updates all active subscriptions payment method.

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

@@ 86-104 (lines=19) @@
83
	 *
84
	 * @since 4.1.11
85
	 */
86
	public function display_update_subs_payment_checkout() {
87
		$subs_statuses = apply_filters( 'wc_stripe_update_subs_payment_method_card_statuses', array( 'active' ) );
88
		if (
89
			apply_filters( 'wc_stripe_display_update_subs_payment_method_card_checkbox', true ) &&
90
			wcs_user_has_subscription( get_current_user_id(), '', $subs_statuses ) &&
91
			is_add_payment_method_page()
92
		) {
93
			$label = esc_html( apply_filters( 'wc_stripe_save_to_subs_text', __( 'Update the Payment Method used for all of my active subscriptions.', 'woocommerce-gateway-stripe' ) ) );
94
			$id    = sprintf( 'wc-%1$s-update-subs-payment-method-card', $this->id );
95
			woocommerce_form_field(
96
				$id,
97
				array(
98
					'type'    => 'checkbox',
99
					'label'   => $label,
100
					'default' => apply_filters( 'wc_stripe_save_to_subs_checked', false ),
101
				)
102
			);
103
		}
104
	}
105
106
	/**
107
	 * Updates all active subscriptions payment method.