Skip to content

Instantly share code, notes, and snippets.

@calina-c
Last active October 19, 2016 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calina-c/4e626d9e435094025f6e9bbba1e9df0a to your computer and use it in GitHub Desktop.
Save calina-c/4e626d9e435094025f6e9bbba1e9df0a to your computer and use it in GitHub Desktop.
Part of IF inversion examples, contains only the tangled version of the function
<?php
function validateApplicationTangled($user) {
if($user->age>18) {
if(($user->hasPreviousApplication && !$user->previousApplicationApproved) || !$user->hasPreviousApplication) {
printf("Cool, application approved for user %s\n", $user->name);
return true;
} else {
printf("Sorry, but the user %s has a previously approved application\n", $user->name);
return false;
}
} else {
printf("Sorry, but the user %s is under 18\n", $user->name);
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment