Code Duplication    Length = 7-19 lines in 2 locations

class.jetpack.php 1 location

@@ 5011-5017 (lines=7) @@
5008
		}
5009
5010
		// Jetpack ID error block
5011
		if ( empty( $registration_response->jetpack_id ) ) {
5012
			return new Jetpack_Error( 'jetpack_id', sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ), $entity );
5013
		} elseif ( ! is_scalar( $registration_response->jetpack_id ) ) {
5014
			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 );
5015
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
5016
			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 );
5017
		}
5018
5019
	    return $registration_response;
5020
	}

packages/connection/src/Manager.php 1 location

@@ 341-359 (lines=19) @@
338
		}
339
340
		// Jetpack ID error block.
341
		if ( empty( $registration_response->jetpack_id ) ) {
342
			return new \WP_Error(
343
				'jetpack_id',
344
				/* translators: %s is an error message string */
345
				sprintf( __( 'Error Details: Jetpack ID is empty. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
346
				$entity
347
			);
348
		} elseif ( ! is_scalar( $registration_response->jetpack_id ) ) {
349
			return new \WP_Error(
350
				'jetpack_id',
351
				/* translators: %s is an error message string */
352
				sprintf( __( 'Error Details: Jetpack ID is not a scalar. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
353
				$entity
354
			);
355
		} elseif ( preg_match( '/[^0-9]/', $registration_response->jetpack_id ) ) {
356
			return new \WP_Error(
357
				'jetpack_id',
358
				/* translators: %s is an error message string */
359
				sprintf( __( 'Error Details: Jetpack ID begins with a numeral. Do not publicly post this error message! %s', 'jetpack' ), $entity ),
360
				$entity
361
			);
362
		}