Code Duplication    Length = 24-24 lines in 2 locations

src/wp-admin/includes/ajax-actions.php 2 locations

@@ 3406-3429 (lines=24) @@
3403
		$status['debug'] = $skin->get_upgrade_messages();
3404
	}
3405
3406
	if ( is_wp_error( $result ) ) {
3407
		$status['errorCode']    = $result->get_error_code();
3408
		$status['errorMessage'] = $result->get_error_message();
3409
		wp_send_json_error( $status );
3410
	} elseif ( is_wp_error( $skin->result ) ) {
3411
		$status['errorCode']    = $skin->result->get_error_code();
3412
		$status['errorMessage'] = $skin->result->get_error_message();
3413
		wp_send_json_error( $status );
3414
	} elseif ( $skin->get_errors()->get_error_code() ) {
3415
		$status['errorMessage'] = $skin->get_error_messages();
3416
		wp_send_json_error( $status );
3417
	} elseif ( is_null( $result ) ) {
3418
		global $wp_filesystem;
3419
3420
		$status['errorCode']    = 'unable_to_connect_to_filesystem';
3421
		$status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
3422
3423
		// Pass through the error from WP_Filesystem if one was raised.
3424
		if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
3425
			$status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() );
3426
		}
3427
3428
		wp_send_json_error( $status );
3429
	}
3430
3431
	$status['themeName'] = wp_get_theme( $slug )->get( 'Name' );
3432
@@ 3668-3691 (lines=24) @@
3665
		$status['debug'] = $skin->get_upgrade_messages();
3666
	}
3667
3668
	if ( is_wp_error( $result ) ) {
3669
		$status['errorCode']    = $result->get_error_code();
3670
		$status['errorMessage'] = $result->get_error_message();
3671
		wp_send_json_error( $status );
3672
	} elseif ( is_wp_error( $skin->result ) ) {
3673
		$status['errorCode']    = $skin->result->get_error_code();
3674
		$status['errorMessage'] = $skin->result->get_error_message();
3675
		wp_send_json_error( $status );
3676
	} elseif ( $skin->get_errors()->get_error_code() ) {
3677
		$status['errorMessage'] = $skin->get_error_messages();
3678
		wp_send_json_error( $status );
3679
	} elseif ( is_null( $result ) ) {
3680
		global $wp_filesystem;
3681
3682
		$status['errorCode']    = 'unable_to_connect_to_filesystem';
3683
		$status['errorMessage'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.' );
3684
3685
		// Pass through the error from WP_Filesystem if one was raised.
3686
		if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
3687
			$status['errorMessage'] = esc_html( $wp_filesystem->errors->get_error_message() );
3688
		}
3689
3690
		wp_send_json_error( $status );
3691
	}
3692
3693
	$install_status = install_plugin_install_status( $api );
3694
	$pagenow = isset( $_POST['pagenow'] ) ? sanitize_key( $_POST['pagenow'] ) : '';