Code Duplication    Length = 9-11 lines in 2 locations

woocommerce-gateway-stripe.php 2 locations

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