Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1020-1027 (lines=8) @@
1017
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1018
				$entity
1019
			);
1020
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1021
			return new \WP_Error(
1022
				'jetpack_id',
1023
				/* translators: %s is an error message string */
1024
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1025
				$entity
1026
			);
1027
		}
1028
1029
		return $registration_response;
1030
	}
@@ 2167-2179 (lines=13) @@
2164
		}
2165
2166
		// No .test or .local domains.
2167
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2168
			return new \WP_Error(
2169
				'fail_domain_tld',
2170
				sprintf(
2171
					/* translators: %1$s is a domain name. */
2172
					__(
2173
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2174
						'jetpack'
2175
					),
2176
					$domain
2177
				)
2178
			);
2179
		}
2180
2181
		// No WPCOM subdomains.
2182
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2182-2194 (lines=13) @@
2179
		}
2180
2181
		// No WPCOM subdomains.
2182
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2183
			return new \WP_Error(
2184
				'fail_subdomain_wpcom',
2185
				sprintf(
2186
					/* translators: %1$s is a domain name. */
2187
					__(
2188
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2189
						'jetpack'
2190
					),
2191
					$domain
2192
				)
2193
			);
2194
		}
2195
2196
		// If PHP was compiled without support for the Filter module (very edge case).
2197
		if ( ! function_exists( 'filter_var' ) ) {