Code Duplication    Length = 7-19 lines in 2 locations

packages/connection/src/Manager.php 1 location

@@ 737-755 (lines=19) @@
734
		}
735
736
		// Jetpack ID error block.
737
		if ( empty( $registration_response->jetpack_id ) ) {
738
			return new \WP_Error(
739
				'jetpack_id',
740
				/* translators: %s is an error message string */
741
				sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
742
				$entity
743
			);
744
		} elseif ( ! is_scalar( $registration_response->jetpack_id ) ) {
745
			return new \WP_Error(
746
				'jetpack_id',
747
				/* translators: %s is an error message string */
748
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
749
				$entity
750
			);
751
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
752
			return new \WP_Error(
753
				'jetpack_id',
754
				/* translators: %s is an error message string */
755
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
756
				$entity
757
			);
758
		}

class.jetpack.php 1 location

@@ 4919-4925 (lines=7) @@
4916
		}
4917
4918
		// Jetpack ID error block
4919
		if ( empty( $registration_response->jetpack_id ) ) {
4920
			return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ), $entity );
4921
		} elseif ( ! is_scalar( $registration_response->jetpack_id ) ) {
4922
			return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ) , $entity ), $entity );
4923
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
4924
			return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ) , $entity ), $entity );
4925
		}
4926
4927
	    return $registration_response;
4928
	}