Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1010-1017 (lines=8) @@
1007
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1008
				$entity
1009
			);
1010
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1011
			return new \WP_Error(
1012
				'jetpack_id',
1013
				/* translators: %s is an error message string */
1014
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1015
				$entity
1016
			);
1017
		}
1018
1019
		return $registration_response;
1020
	}
@@ 2153-2165 (lines=13) @@
2150
		}
2151
2152
		// No .test or .local domains.
2153
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2154
			return new \WP_Error(
2155
				'fail_domain_tld',
2156
				sprintf(
2157
					/* translators: %1$s is a domain name. */
2158
					__(
2159
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2160
						'jetpack'
2161
					),
2162
					$domain
2163
				)
2164
			);
2165
		}
2166
2167
		// No WPCOM subdomains.
2168
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2168-2180 (lines=13) @@
2165
		}
2166
2167
		// No WPCOM subdomains.
2168
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2169
			return new \WP_Error(
2170
				'fail_subdomain_wpcom',
2171
				sprintf(
2172
					/* translators: %1$s is a domain name. */
2173
					__(
2174
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2175
						'jetpack'
2176
					),
2177
					$domain
2178
				)
2179
			);
2180
		}
2181
2182
		// If PHP was compiled without support for the Filter module (very edge case).
2183
		if ( ! function_exists( 'filter_var' ) ) {