Code Duplication    Length = 15-15 lines in 2 locations

includes/class-give-donor.php 2 locations

@@ 524-538 (lines=15) @@
521
522
		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
523
524
		if ( $payment_added ) {
525
526
			$this->payment_ids = $new_payment_ids;
527
528
			// We added this payment successfully, increment the stats
529
			if ( $update_stats ) {
530
				$payment_amount = give_donation_amount( $payment_id, array( 'type' => 'stats' ) );
531
532
				if ( ! empty( $payment_amount ) ) {
533
					$this->increase_value( $payment_amount );
534
				}
535
536
				$this->increase_purchase_count();
537
			}
538
		}
539
540
		/**
541
		 * Fires after attaching payments to the donor.
@@ 609-623 (lines=15) @@
606
607
		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
608
609
		if ( $payment_removed ) {
610
611
			$this->payment_ids = $new_payment_ids;
612
613
			if ( $update_stats ) {
614
				// We removed this payment successfully, decrement the stats
615
				$payment_amount = give_donation_amount( $payment_id );
616
617
				if ( ! empty( $payment_amount ) ) {
618
					$this->decrease_value( $payment_amount );
619
				}
620
621
				$this->decrease_donation_count();
622
			}
623
		}
624
625
		/**
626
		 * Fires after removing payments from donors.