Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1124-1131 (lines=8) @@
1121
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1122
				$entity
1123
			);
1124
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1125
			return new \WP_Error(
1126
				'jetpack_id',
1127
				/* translators: %s is an error message string */
1128
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1129
				$entity
1130
			);
1131
		}
1132
1133
		return $registration_response;
1134
	}
@@ 2267-2279 (lines=13) @@
2264
		}
2265
2266
		// No .test or .local domains.
2267
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2268
			return new \WP_Error(
2269
				'fail_domain_tld',
2270
				sprintf(
2271
					/* translators: %1$s is a domain name. */
2272
					__(
2273
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2274
						'jetpack'
2275
					),
2276
					$domain
2277
				)
2278
			);
2279
		}
2280
2281
		// No WPCOM subdomains.
2282
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2282-2294 (lines=13) @@
2279
		}
2280
2281
		// No WPCOM subdomains.
2282
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2283
			return new \WP_Error(
2284
				'fail_subdomain_wpcom',
2285
				sprintf(
2286
					/* translators: %1$s is a domain name. */
2287
					__(
2288
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2289
						'jetpack'
2290
					),
2291
					$domain
2292
				)
2293
			);
2294
		}
2295
2296
		// If PHP was compiled without support for the Filter module (very edge case).
2297
		if ( ! function_exists( 'filter_var' ) ) {