Created
October 19, 2016 07:13
-
-
Save calina-c/9535b937c459e2de3b45fb97869b6443 to your computer and use it in GitHub Desktop.
Part of IF inversion examples, contains only the untangled version of the function
This file contains 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 validateApplicationUntangled($user) { | |
if($user->age<18) { | |
printf("Sorry, but the user %s is under 18\n", $user->name); | |
return false; | |
} | |
if($user->hasPreviousApplication && $user->previousApplicationApproved) { | |
printf("Sorry, but the user %s has a previously approved application\n", $user->name); | |
return false; | |
} | |
printf("Cool, application approved for user %s\n", $user->name); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment