Code Duplication    Length = 9-11 lines in 2 locations

woocommerce-gateway-stripe.php 2 locations

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