Code Duplication    Length = 16-22 lines in 2 locations

includes/class-give-donate-form.php 2 locations

@@ 1014-1029 (lines=16) @@
1011
	 *
1012
	 * @return float|false
1013
	 */
1014
	public function increase_earnings( $amount = 0 ) {
1015
1016
		$earnings   = give_get_form_earnings_stats( $this->ID );
1017
		$new_amount = $earnings + (float) $amount;
1018
1019
		if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1020
1021
			$this->earnings = $new_amount;
1022
1023
			return $this->earnings;
1024
1025
		}
1026
1027
		return false;
1028
1029
	}
1030
1031
	/**
1032
	 * Decrease the earnings by the given amount
@@ 1041-1062 (lines=22) @@
1038
	 *
1039
	 * @return float|false
1040
	 */
1041
	public function decrease_earnings( $amount ) {
1042
1043
		$earnings = give_get_form_earnings_stats( $this->ID );
1044
1045
		if ( $earnings > 0 ) {
1046
			// Only decrease if greater than zero
1047
			$new_amount = $earnings - (float) $amount;
1048
1049
1050
			if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) {
1051
1052
				$this->earnings = $new_amount;
1053
1054
				return $this->earnings;
1055
1056
			}
1057
1058
		}
1059
1060
		return false;
1061
1062
	}
1063
1064
	/**
1065
	 * Determine if the donation is free or if the given price ID is free