Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1015-1022 (lines=8) @@
1012
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1013
				$entity
1014
			);
1015
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1016
			return new \WP_Error(
1017
				'jetpack_id',
1018
				/* translators: %s is an error message string */
1019
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1020
				$entity
1021
			);
1022
		}
1023
1024
		return $registration_response;
1025
	}
@@ 2158-2170 (lines=13) @@
2155
		}
2156
2157
		// No .test or .local domains.
2158
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
2159
			return new \WP_Error(
2160
				'fail_domain_tld',
2161
				sprintf(
2162
					/* translators: %1$s is a domain name. */
2163
					__(
2164
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
2165
						'jetpack'
2166
					),
2167
					$domain
2168
				)
2169
			);
2170
		}
2171
2172
		// No WPCOM subdomains.
2173
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 2173-2185 (lines=13) @@
2170
		}
2171
2172
		// No WPCOM subdomains.
2173
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
2174
			return new \WP_Error(
2175
				'fail_subdomain_wpcom',
2176
				sprintf(
2177
					/* translators: %1$s is a domain name. */
2178
					__(
2179
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
2180
						'jetpack'
2181
					),
2182
					$domain
2183
				)
2184
			);
2185
		}
2186
2187
		// If PHP was compiled without support for the Filter module (very edge case).
2188
		if ( ! function_exists( 'filter_var' ) ) {