Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
function getTotalWithTax(Payment $payment, int $taxPercent): float
{
// descriptive variables with intermediary values for easier debugging
$paymentAmount = (int) $payment->getAmount();
$taxCoefficient = 1 + ($taxPercent / 100);
$totalWithTax = $paymentAmount * $taxCoefficient;
return (float) $totalWithTax;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment