Code Duplication    Length = 8-13 lines in 3 locations

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

@@ 1743-1755 (lines=13) @@
1740
		}
1741
1742
		// No .test or .local domains.
1743
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
1744
			return new \WP_Error(
1745
				'fail_domain_tld',
1746
				sprintf(
1747
					/* translators: %1$s is a domain name. */
1748
					__(
1749
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
1750
						'jetpack'
1751
					),
1752
					$domain
1753
				)
1754
			);
1755
		}
1756
1757
		// No WPCOM subdomains.
1758
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 1758-1770 (lines=13) @@
1755
		}
1756
1757
		// No WPCOM subdomains.
1758
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
1759
			return new \WP_Error(
1760
				'fail_subdomain_wpcom',
1761
				sprintf(
1762
					/* translators: %1$s is a domain name. */
1763
					__(
1764
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
1765
						'jetpack'
1766
					),
1767
					$domain
1768
				)
1769
			);
1770
		}
1771
1772
		// If PHP was compiled without support for the Filter module (very edge case).
1773
		if ( ! function_exists( 'filter_var' ) ) {
@@ 1041-1048 (lines=8) @@
1038
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1039
				$entity
1040
			);
1041
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
1042
			return new \WP_Error(
1043
				'jetpack_id',
1044
				/* translators: %s is an error message string */
1045
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
1046
				$entity
1047
			);
1048
		}
1049
1050
		return $registration_response;
1051
	}