Code Duplication    Length = 3-5 lines in 7 locations

includes/import-functions.php 7 locations

@@ 68-72 (lines=5) @@
65
		$form = new Give_Donate_Form( $data['form_id'] );
66
		// Add support to older php version.
67
		$form_id = $form->get_ID();
68
		if ( empty( $form_id ) ) {
69
			$form = false;
70
		} else {
71
			$report['duplicate_form'] = ( ! empty( $report['duplicate_form'] ) ? ( absint( $report['duplicate_form'] ) + 1 ) : 1 );
72
		}
73
	}
74
75
	if ( false === $form && ! empty( $data['form_title'] ) ) {
@@ 232-234 (lines=3) @@
229
	// check if donor id is not empty
230
	if ( ! empty( $data['donor_id'] ) ) {
231
		$donor_data = new Give_Donor( (int) $data['donor_id'] );
232
		if ( ! empty( $donor_data->id ) ) {
233
			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
234
		}
235
	}
236
237
	if ( empty( $donor_data->id ) && ! empty( $data['user_id'] ) ) {
@@ 325-328 (lines=4) @@
322
					$donor_data = new Give_Donor( $donor_id, true );
323
					$donor_data->update_meta( '_give_payment_import', true );
324
325
				} else {
326
					$dry_run_donor_create   = true;
327
					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
328
				}
329
			} else {
330
				$donor_id = ( ! empty( $donor_data->ID ) ? $donor_data->ID : false );
331
			}
@@ 360-362 (lines=3) @@
357
						$dry_run_donor_create = true;
358
					}
359
					$report['create_donor'] = ( ! empty( $report['create_donor'] ) ? ( absint( $report['create_donor'] ) + 1 ) : 1 );
360
				} else {
361
					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
362
				}
363
			}
364
		} else {
365
			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
@@ 364-366 (lines=3) @@
361
					$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
362
				}
363
			}
364
		} else {
365
			$report['duplicate_donor'] = ( ! empty( $report['duplicate_donor'] ) ? ( absint( $report['duplicate_donor'] ) + 1 ) : 1 );
366
		}
367
	}
368
369
	// update the report
@@ 889-892 (lines=4) @@
886
					$payment->update_status( $status );
887
				}
888
889
			} else {
890
				$report['failed_donation'] = ( ! empty( $report['failed_donation'] ) ? ( absint( $report['failed_donation'] ) + 1 ) : 1 );
891
				$payment_id                = false;
892
			}
893
894
			/**
895
			 * Fire after payment is imported and payment meta is also being imported.
@@ 906-909 (lines=4) @@
903
			 * @param object $donor_data form object
904
			 */
905
			do_action( 'give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form );
906
		} else {
907
			$report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 );
908
			$payment_id                = true;
909
		}
910
	}
911
912
	// update the report