Code Duplication    Length = 4-9 lines in 2 locations

class.jetpack-cli.php 2 locations

@@ 121-124 (lines=4) @@
118
			Jetpack_Client::WPCOM_JSON_API_VERSION
119
		);
120
121
		if ( is_wp_error( $response ) ) {
122
			/* translators: %1$s is the error code, %2$s is the error message */
123
			WP_CLI::error( sprintf( __( 'Failed to test connection (#%1$s: %2$s)', 'jetpack' ), $response->get_error_code(), $response->get_error_message() ) );
124
		}
125
126
		$body = wp_remote_retrieve_body( $response );
127
		if ( ! $body ) {
@@ 1123-1131 (lines=9) @@
1120
			$named_args['base_api_path']
1121
		);
1122
1123
		if ( is_wp_error( $response ) ) {
1124
			WP_CLI::error( sprintf(
1125
				/* translators: %1$s is an endpoint route (ex. /sites/123456), %2$d is an error code, %3$s is an error message. */
1126
				__( 'Request to %1$s returned an error: (%2$d) %3$s.', 'jetpack' ),
1127
				$resource_url,
1128
				$response->get_error_code(),
1129
				$response->get_error_message()
1130
			) );
1131
		}
1132
1133
		if ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
1134
			WP_CLI::error( sprintf(