Code Duplication    Length = 8-13 lines in 3 locations

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

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