SuitedUpDev, (edited ) I'm a big proponent of doing fewer if statements and early returns! Doing stuff in your if statements only increases cognitive load when trying to read the code.
public function sendActivationEmail($user) {
if (! $user->isActivated) {
// Send out activation email
}
}versus.
public function sendActivationEmail($user) {
if ($user->isActivated) {
return;
}// Send out activation email
}
Add comment