I have command handler that returns approve param which is boolean type and can be true or false. I have specific setters there and I defined it like:
if ($command->approve()) {
$schedule->setApproval(true);
$schedule->setApprovalAt(new DateTime());
} else {
$schedule->setApproval(false);
$schedule->setApprovalAt(null);
}
Is there any cleaner approach to this? Can we skip this kind of repetition and using of else clause?