Code Duplication    Length = 7-7 lines in 2 locations

_inc/class.jetpack-provision.php 2 locations

@@ 168-174 (lines=7) @@
165
		$response_code = wp_remote_retrieve_response_code( $result );
166
		$body_json     = json_decode( wp_remote_retrieve_body( $result ) );
167
168
		if( 200 !== $response_code ) {
169
			if ( isset( $body_json->error ) ) {
170
				return new WP_Error( $body_json->error, $body_json->message );
171
			} else {
172
				return new WP_Error( 'server_error', sprintf( __( "Request failed with code %s" ), $response_code ) );
173
			}
174
		}
175
176
		if ( isset( $body_json->access_token ) ) {
177
			// check if this matches the existing token before replacing
@@ 231-237 (lines=7) @@
228
		$response_code = wp_remote_retrieve_response_code( $result );
229
		$body_json     = json_decode( wp_remote_retrieve_body( $result ) );
230
231
		if( 200 !== $response_code ) {
232
			if ( isset( $body_json->error ) ) {
233
				return new WP_Error( $body_json->error, $body_json->message );
234
			} else {
235
				return new WP_Error( 'server_error', sprintf( __( "Request failed with code %s" ), $response_code ) );
236
			}
237
		}
238
239
		return true;
240
	}