Code Duplication    Length = 20-20 lines in 2 locations

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

@@ 919-938 (lines=20) @@
916
	 *
917
	 * @return int    Donation form sale count.
918
	 */
919
	public function get_sales() {
920
921
		if ( ! isset( $this->sales ) ) {
922
923
			if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) {
924
				add_post_meta( $this->ID, '_give_form_sales', 0 );
925
			} // End if
926
927
			$this->sales = give_get_meta( $this->ID, '_give_form_sales', true );
928
929
			if ( $this->sales < 0 ) {
930
				// Never let sales be less than zero.
931
				$this->sales = 0;
932
			}
933
934
		}
935
936
		return $this->sales;
937
938
	}
939
940
	/**
941
	 * Increment the sale count by one
@@ 1009-1028 (lines=20) @@
1006
	 *
1007
	 * @return float  Donation form total earnings.
1008
	 */
1009
	public function get_earnings() {
1010
1011
		if ( ! isset( $this->earnings ) ) {
1012
1013
			if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) {
1014
				add_post_meta( $this->ID, '_give_form_earnings', 0 );
1015
			}
1016
1017
			$this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true );
1018
1019
			if ( $this->earnings < 0 ) {
1020
				// Never let earnings be less than zero
1021
				$this->earnings = 0;
1022
			}
1023
1024
		}
1025
1026
		return $this->earnings;
1027
1028
	}
1029
1030
	/**
1031
	 * Increase the earnings by the given amount