amtType($setup, $sub_total); case 'free': return $this->freeType($setup, $sub_total); } } public function amtType($setup, $sub_total) { $chargeAmt = 0; foreach ($setup['ShippingChargeBase'] ?? [] as $base) { if ($base['From'] <= $sub_total && $base['To'] > $sub_total) { $chargeAmt = $base['ChargeAmt']; break; } } return $chargeAmt; } public function freeType($setup, $sub_total) { return 0; } }