Code Duplication    Length = 7-19 lines in 2 locations

class.jetpack.php 1 location

@@ 5033-5039 (lines=7) @@
5030
		}
5031
5032
		// Jetpack ID error block
5033
		if ( empty( $registration_response->jetpack_id ) ) {
5034
			return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ), $entity );
5035
		} elseif ( ! is_scalar( $registration_response->jetpack_id ) ) {
5036
			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 );
5037
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
5038
			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 );
5039
		}
5040
5041
	    return $registration_response;
5042
	}

packages/connection/src/Manager.php 1 location

@@ 306-324 (lines=19) @@
303
		}
304
305
		// Jetpack ID error block
306
		if ( empty( $registration_response->jetpack_id ) ) {
307
			return new \WP_Error(
308
				'jetpack_id',
309
				sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
310
				$entity
311
			);
312
		} elseif ( ! is_scalar( $registration_response->jetpack_id ) ) {
313
			return new \WP_Error(
314
				'jetpack_id',
315
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
316
				$entity
317
			);
318
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
319
			return new \WP_Error(
320
				'jetpack_id',
321
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
322
				$entity
323
			);
324
		}
325
326
		return $registration_response;
327
	}