Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1097-1104 (lines=8) @@
1094
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1095
				$entity
1096
			);
1097
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1098
			return new \WP_Error(
1099
				'jetpack_id',
1100
				/* translators: %s is an error message string */
1101
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1102
				$entity
1103
			);
1104
		}
1105
1106
		return $registration_response;
1107
	}
@@ 2239-2251 (lines=13) @@
2236
		}
2237
2238
		// No .test or .local domains.
2239
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2240
			return new \WP_Error(
2241
				'fail_domain_tld',
2242
				sprintf(
2243
					/* translators: %1$s is a domain name. */
2244
					__(
2245
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2246
						'jetpack'
2247
					),
2248
					$domain
2249
				)
2250
			);
2251
		}
2252
2253
		// No WPCOM subdomains.
2254
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2254-2266 (lines=13) @@
2251
		}
2252
2253
		// No WPCOM subdomains.
2254
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2255
			return new \WP_Error(
2256
				'fail_subdomain_wpcom',
2257
				sprintf(
2258
					/* translators: %1$s is a domain name. */
2259
					__(
2260
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2261
						'jetpack'
2262
					),
2263
					$domain
2264
				)
2265
			);
2266
		}
2267
2268
		// If PHP was compiled without support for the Filter module (very edge case).
2269
		if ( ! function_exists( 'filter_var' ) ) {