Code Duplication    Length = 10-10 lines in 4 locations

includes/admin/admin-actions.php 4 locations

@@ 882-891 (lines=10) @@
879
	);
880
881
	// Security check.
882
	if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) {
883
		wp_send_json_error( array(
884
				'error'     => 1,
885
				'error_msg' => wp_sprintf(
886
					'<div class="notice notice-error"><p>%s</p></div>',
887
					__( 'Error: Security issue.', 'give' )
888
				),
889
			)
890
		);
891
	}
892
893
	$donor = new Give_Donor( $donorID );
894
@@ 913-922 (lines=10) @@
910
	switch ( $response_data['action'] ) {
911
912
		case 'add':
913
			if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) {
914
				wp_send_json_error( array(
915
						'error'     => 1,
916
						'error_msg' => wp_sprintf(
917
							'<div class="notice notice-error"><p>%s</p></div>',
918
							__( 'Error: Unable to save the address. Please check if address already exist.', 'give' )
919
						),
920
					)
921
				);
922
			}
923
924
			$total_addresses = count( $donor->address[ $address_type ] );
925
@@ 957-966 (lines=10) @@
954
			break;
955
956
		case 'remove':
957
			if ( ! $donor->remove_address( $response_data['id'] ) ) {
958
				wp_send_json_error( array(
959
						'error'     => 2,
960
						'error_msg' => wp_sprintf(
961
							'<div class="notice notice-error"><p>%s</p></div>',
962
							__( 'Error: Unable to delete address.', 'give' )
963
						),
964
					)
965
				);
966
			}
967
968
			$response_data['success_msg'] = wp_sprintf(
969
				'<div class="notice updated"><p>%s</p></div>',
@@ 976-985 (lines=10) @@
973
			break;
974
975
		case 'update':
976
			if ( ! $donor->update_address( $response_data['id'], $form_data ) ) {
977
				wp_send_json_error( array(
978
						'error'     => 3,
979
						'error_msg' => wp_sprintf(
980
							'<div class="notice notice-error"><p>%s</p></div>',
981
							__( 'Error: Unable to update address. Please check if address already exist.', 'give' )
982
						),
983
					)
984
				);
985
			}
986
987
			$response_data['address_html'] = __give_get_format_address(
988
				$is_multi_address_type ?