Code Duplication    Length = 8-13 lines in 3 locations

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

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