Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1013-1020 (lines=8) @@
1010
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1011
				$entity
1012
			);
1013
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1014
			return new \WP_Error(
1015
				'jetpack_id',
1016
				/* translators: %s is an error message string */
1017
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1018
				$entity
1019
			);
1020
		}
1021
1022
		return $registration_response;
1023
	}
@@ 2049-2061 (lines=13) @@
2046
		}
2047
2048
		// No .test or .local domains.
2049
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2050
			return new \WP_Error(
2051
				'fail_domain_tld',
2052
				sprintf(
2053
					/* translators: %1$s is a domain name. */
2054
					__(
2055
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2056
						'jetpack'
2057
					),
2058
					$domain
2059
				)
2060
			);
2061
		}
2062
2063
		// No WPCOM subdomains.
2064
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2064-2076 (lines=13) @@
2061
		}
2062
2063
		// No WPCOM subdomains.
2064
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2065
			return new \WP_Error(
2066
				'fail_subdomain_wpcom',
2067
				sprintf(
2068
					/* translators: %1$s is a domain name. */
2069
					__(
2070
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2071
						'jetpack'
2072
					),
2073
					$domain
2074
				)
2075
			);
2076
		}
2077
2078
		// If PHP was compiled without support for the Filter module (very edge case).
2079
		if ( ! function_exists( 'filter_var' ) ) {