Code Duplication    Length = 8-13 lines in 3 locations

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

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