Code Duplication    Length = 8-13 lines in 3 locations

packages/connection/src/class-manager.php 3 locations

@@ 919-926 (lines=8) @@
916
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
917
				$entity
918
			);
919
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
920
			return new \WP_Error(
921
				'jetpack_id',
922
				/* translators: %s is an error message string */
923
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
924
				$entity
925
			);
926
		}
927
928
		return $registration_response;
929
	}
@@ 1470-1482 (lines=13) @@
1467
		}
1468
1469
		// No .test or .local domains.
1470
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
1471
			return new \WP_Error(
1472
				'fail_domain_tld',
1473
				sprintf(
1474
					/* translators: %1$s is a domain name. */
1475
					__(
1476
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
1477
						'jetpack'
1478
					),
1479
					$domain
1480
				)
1481
			);
1482
		}
1483
1484
		// No WPCOM subdomains.
1485
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 1485-1497 (lines=13) @@
1482
		}
1483
1484
		// No WPCOM subdomains.
1485
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
1486
			return new \WP_Error(
1487
				'fail_subdomain_wpcom',
1488
				sprintf(
1489
					/* translators: %1$s is a domain name. */
1490
					__(
1491
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
1492
						'jetpack'
1493
					),
1494
					$domain
1495
				)
1496
			);
1497
		}
1498
1499
		// If PHP was compiled without support for the Filter module (very edge case).
1500
		if ( ! function_exists( 'filter_var' ) ) {