Code Duplication    Length = 9-11 lines in 2 locations

woocommerce-gateway-stripe.php 2 locations

@@ 294-302 (lines=9) @@
291
292
				// Check if keys are entered properly per live/test mode.
293
				if ( $testmode ) {
294
					if (
295
						! empty( $test_pub_key ) && ! preg_match( '/^pk_test_/', $test_pub_key )
296
						|| ( ! empty( $test_secret_key ) && ! preg_match( '/^sk_test_/', $test_secret_key )
297
						&& ! empty( $test_secret_key ) && ! preg_match( '/^rk_test_/', $test_secret_key ) ) )
298
					{
299
						$setting_link = $this->get_setting_link();
300
						/* translators: 1) link */
301
						$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 );
302
					}
303
				} else {
304
					if (
305
						! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
@@ 303-313 (lines=11) @@
300
						/* translators: 1) link */
301
						$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 );
302
					}
303
				} else {
304
					if (
305
						! empty( $live_pub_key ) && ! preg_match( '/^pk_live_/', $live_pub_key )
306
						|| ( ! empty( $live_secret_key ) && ! preg_match( '/^sk_live_/', $live_secret_key )
307
						&& ! empty( $live_secret_key ) && ! preg_match( '/^rk_live_/', $live_secret_key ) ) )
308
					{
309
						$setting_link = $this->get_setting_link();
310
						/* translators: 1) link */
311
						$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 );
312
					}
313
				}
314
			}
315
316
			if ( empty( $show_ssl_notice ) && isset( $options['enabled'] ) && 'yes' === $options['enabled'] ) {