Code Duplication    Length = 6-11 lines in 2 locations

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

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

includes/forms/functions.php 1 location

@@ 912-917 (lines=6) @@
909
910
	$amount = 0.00;
911
912
	foreach ( $prices as $price ) {
913
		if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) {
914
			$amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00;
915
			break;
916
		};
917
	}
918
919
	return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id );
920
}