samedi 4 juillet 2020

Refactor if-else to one line

Inside my funciton I check if password/email are valid.

I do it like this:

if ( ! Password::isSafe())
{
     print Password::getSafetyError();

     return;
}

Can I do it one line only?

It would be good not to use Exceptions, cause Global ExceptionHandler write exceptions to log, and this way I will need to filter typical user errors inside this ExceptionHandler.

Aucun commentaire:

Enregistrer un commentaire