Code Duplication    Length = 6-11 lines in 2 locations

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

@@ 1078-1088 (lines=11) @@
1075
				$donation_amount = '';
1076
1077
				// Loop through prices.
1078
				foreach ( $prices as $price ) {
1079
					// Find a match between price_id and level_id.
1080
					// First verify array keys exists THEN make the match.
1081
					if (
1082
						isset( $args['price_id'] ) &&
1083
						isset( $price['_give_id']['level_id'] ) &&
1084
						$args['price_id'] === (int) $price['_give_id']['level_id']
1085
					) {
1086
						$donation_amount = $price['_give_amount'];
1087
					}
1088
				}
1089
1090
				// Fallback to the lowest price point.
1091
				if ( '' === $donation_amount ) {

includes/forms/functions.php 1 location

@@ 922-927 (lines=6) @@
919
920
	$amount = 0.00;
921
922
	foreach ( $prices as $price ) {
923
		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
924
			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
925
			break;
926
		};
927
	}
928
929
	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
930
}