Code Duplication    Length = 9-11 lines in 2 locations

includes/admin/class-wc-stripe-admin-notices.php 2 locations

@@ 123-131 (lines=9) @@
120
121
			// Check if keys are entered properly per live/test mode.
122
			if ( $testmode ) {
123
				if (
124
					! empty( $test_pub_key ) && ! preg_match( '/^pk_test_/', $test_pub_key )
125
					|| ( ! empty( $test_secret_key ) && ! preg_match( '/^sk_test_/', $test_secret_key )
126
					&& ! empty( $test_secret_key ) && ! preg_match( '/^rk_test_/', $test_secret_key ) ) )
127
				{
128
					$setting_link = $this->get_setting_link();
129
					/* translators: 1) link */
130
					$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test or rk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
131
				}
132
			} else {
133
				if (
134
					! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
@@ 132-142 (lines=11) @@
129
					/* translators: 1) link */
130
					$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in test mode however your test keys may not be valid. Test keys start with pk_test and sk_test or rk_test. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
131
				}
132
			} else {
133
				if (
134
					! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
135
					|| ( ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key )
136
					&& ! empty( $live_secret_key ) && ! preg_match( '/^rk_live_/', $live_secret_key ) ) )
137
				{
138
					$setting_link = $this->get_setting_link();
139
					/* translators: 1) link */
140
					$this->add_admin_notice( 'keys', 'notice notice-error', sprintf( __( 'Stripe is in live mode however your test keys may not be valid. Live keys start with pk_live and sk_live or rk_live. Please go to your settings and, <a href="%s">set your Stripe account keys</a>.', 'woocommerce-gateway-stripe' ), $setting_link ), true );
141
				}
142
			}
143
		}
144
145
		if ( empty( $show_ssl_notice ) && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {