Code Duplication    Length = 7-11 lines in 2 locations

_inc/class.jetpack-provision.php 2 locations

@@ 206-216 (lines=11) @@
203
		$response_code = wp_remote_retrieve_response_code( $result );
204
		$body_json     = json_decode( wp_remote_retrieve_body( $result ) );
205
206
		if ( 200 !== $response_code ) {
207
			if ( isset( $body_json->error ) ) {
208
				return new WP_Error( $body_json->error, $body_json->message );
209
			} else {
210
				return new WP_Error(
211
					'server_error',
212
					/* translators: %s is an HTTP status code retured from an API request. Ex. – 400 */
213
					sprintf( __( 'Request failed with code %s', 'jetpack' ), $response_code )
214
				);
215
			}
216
		}
217
218
		if ( isset( $body_json->access_token ) && is_user_logged_in() ) {
219
			// Check if this matches the existing token before replacing.
@@ 273-279 (lines=7) @@
270
		$response_code = wp_remote_retrieve_response_code( $result );
271
		$body_json     = json_decode( wp_remote_retrieve_body( $result ) );
272
273
		if( 200 !== $response_code ) {
274
			if ( isset( $body_json->error ) ) {
275
				return new WP_Error( $body_json->error, $body_json->message );
276
			} else {
277
				return new WP_Error( 'server_error', sprintf( __( 'Request failed with code %s', 'jetpack' ), $response_code ) );
278
			}
279
		}
280
281
		return true;
282
	}