Code Duplication    Length = 8-13 lines in 3 locations

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

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