Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1017-1024 (lines=8) @@
1014
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1015
				$entity
1016
			);
1017
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1018
			return new \WP_Error(
1019
				'jetpack_id',
1020
				/* translators: %s is an error message string */
1021
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1022
				$entity
1023
			);
1024
		}
1025
1026
		return $registration_response;
1027
	}
@@ 2065-2077 (lines=13) @@
2062
		}
2063
2064
		// No .test or .local domains.
2065
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2066
			return new \WP_Error(
2067
				'fail_domain_tld',
2068
				sprintf(
2069
					/* translators: %1$s is a domain name. */
2070
					__(
2071
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2072
						'jetpack'
2073
					),
2074
					$domain
2075
				)
2076
			);
2077
		}
2078
2079
		// No WPCOM subdomains.
2080
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2080-2092 (lines=13) @@
2077
		}
2078
2079
		// No WPCOM subdomains.
2080
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2081
			return new \WP_Error(
2082
				'fail_subdomain_wpcom',
2083
				sprintf(
2084
					/* translators: %1$s is a domain name. */
2085
					__(
2086
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2087
						'jetpack'
2088
					),
2089
					$domain
2090
				)
2091
			);
2092
		}
2093
2094
		// If PHP was compiled without support for the Filter module (very edge case).
2095
		if ( ! function_exists( 'filter_var' ) ) {