Last active
August 9, 2022 19:04
-
-
Save mikemix/d4a97bdab7b5d295d4bc15091b78ddaa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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