Code Duplication    Length = 8-13 lines in 3 locations

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

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