Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1954-1966 (lines=13) @@
1951
		}
1952
1953
		// No .test or .local domains.
1954
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
1955
			return new \WP_Error(
1956
				'fail_domain_tld',
1957
				sprintf(
1958
					/* translators: %1$s is a domain name. */
1959
					__(
1960
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
1961
						'jetpack'
1962
					),
1963
					$domain
1964
				)
1965
			);
1966
		}
1967
1968
		// No WPCOM subdomains.
1969
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 1969-1981 (lines=13) @@
1966
		}
1967
1968
		// No WPCOM subdomains.
1969
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
1970
			return new \WP_Error(
1971
				'fail_subdomain_wpcom',
1972
				sprintf(
1973
					/* translators: %1$s is a domain name. */
1974
					__(
1975
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
1976
						'jetpack'
1977
					),
1978
					$domain
1979
				)
1980
			);
1981
		}
1982
1983
		// If PHP was compiled without support for the Filter module (very edge case).
1984
		if ( ! function_exists( 'filter_var' ) ) {
@@ 1028-1035 (lines=8) @@
1025
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1026
				$entity
1027
			);
1028
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1029
			return new \WP_Error(
1030
				'jetpack_id',
1031
				/* translators: %s is an error message string */
1032
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1033
				$entity
1034
			);
1035
		}
1036
1037
		return $registration_response;
1038
	}