Code Duplication    Length = 8-13 lines in 3 locations

packages/connection/src/Manager.php 3 locations

@@ 919-926 (lines=8) @@
916
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
917
				$entity
918
			);
919
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
920
			return new \WP_Error(
921
				'jetpack_id',
922
				/* translators: %s is an error message string */
923
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
924
				$entity
925
			);
926
		}
927
928
		return $registration_response;
929
	}
@@ 1465-1477 (lines=13) @@
1462
		}
1463
1464
		// No .test or .local domains.
1465
		if ( preg_match( '#\.(test|local)$#i', $domain ) ) {
1466
			return new \WP_Error(
1467
				'fail_domain_tld',
1468
				sprintf(
1469
					/* translators: %1$s is a domain name. */
1470
					__(
1471
						'Domain `%1$s` just failed is_usable_domain check as it uses an invalid top level domain.',
1472
						'jetpack'
1473
					),
1474
					$domain
1475
				)
1476
			);
1477
		}
1478
1479
		// No WPCOM subdomains.
1480
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
@@ 1480-1492 (lines=13) @@
1477
		}
1478
1479
		// No WPCOM subdomains.
1480
		if ( preg_match( '#\.WordPress\.com$#i', $domain ) ) {
1481
			return new \WP_Error(
1482
				'fail_subdomain_wpcom',
1483
				sprintf(
1484
					/* translators: %1$s is a domain name. */
1485
					__(
1486
						'Domain `%1$s` just failed is_usable_domain check as it is a subdomain of WordPress.com.',
1487
						'jetpack'
1488
					),
1489
					$domain
1490
				)
1491
			);
1492
		}
1493
1494
		// If PHP was compiled without support for the Filter module (very edge case).
1495
		if ( ! function_exists( 'filter_var' ) ) {