Code Duplication    Length = 6-11 lines in 2 locations

includes/payments/class-give-payment.php 1 location

@@ 1069-1079 (lines=11) @@
1066
				$donation_amount = '';
1067
1068
				// Loop through prices.
1069
				foreach ( $prices as $price ) {
1070
					// Find a match between price_id and level_id.
1071
					// First verify array keys exists THEN make the match.
1072
					if (
1073
						isset( $args['price_id'] ) &&
1074
						isset( $price['_give_id']['level_id'] ) &&
1075
						$args['price_id'] === (int) $price['_give_id']['level_id']
1076
					) {
1077
						$donation_amount = $price['_give_amount'];
1078
					}
1079
				}
1080
1081
				// Fallback to the lowest price point.
1082
				if ( '' === $donation_amount ) {

includes/forms/functions.php 1 location

@@ 868-873 (lines=6) @@
865
866
	$amount = 0.00;
867
868
	foreach ( $prices as $price ) {
869
		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
870
			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
871
			break;
872
		};
873
	}
874
875
	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
876
}