Code Duplication    Length = 8-13 lines in 3 locations

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

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