Closed khairahmanplus closed 5 years ago
I'm sorry but I fail to see the value in this proposal.
Is the above equivalent to the following code?
$salary = '3000.70';
$employerContributeTax = true;
$employerContributeInsurance = true;
$gross = Money::of($salary);
if ($employerContributeTax) {
$salary = $salary->minus($someNumber);
}
if ($employerContributeInsurance) {
$salary = $salary->minus($someNumberAgain);
}
If so, what's wrong with this approach?
Closing due to absence of feedback. Please feel free to comment if you think this should be reopened.
I have use case where i need to chain a lot of numbers based on true/false conditional. Idea is from method
when
in Laravel Framework.https://github.com/laravel/framework/blob/5.8/src/Illuminate/Database/Concerns/BuildsQueries.php#L88