Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1033-1040 (lines=8) @@
1030
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1031
				$entity
1032
			);
1033
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1034
			return new \WP_Error(
1035
				'jetpack_id',
1036
				/* translators: %s is an error message string */
1037
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1038
				$entity
1039
			);
1040
		}
1041
1042
		return $registration_response;
1043
	}
@@ 2175-2187 (lines=13) @@
2172
		}
2173
2174
		// No .test or .local domains.
2175
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2176
			return new \WP_Error(
2177
				'fail_domain_tld',
2178
				sprintf(
2179
					/* translators: %1$s is a domain name. */
2180
					__(
2181
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2182
						'jetpack'
2183
					),
2184
					$domain
2185
				)
2186
			);
2187
		}
2188
2189
		// No WPCOM subdomains.
2190
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2190-2202 (lines=13) @@
2187
		}
2188
2189
		// No WPCOM subdomains.
2190
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2191
			return new \WP_Error(
2192
				'fail_subdomain_wpcom',
2193
				sprintf(
2194
					/* translators: %1$s is a domain name. */
2195
					__(
2196
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2197
						'jetpack'
2198
					),
2199
					$domain
2200
				)
2201
			);
2202
		}
2203
2204
		// If PHP was compiled without support for the Filter module (very edge case).
2205
		if ( ! function_exists( 'filter_var' ) ) {