Skip to content

Instantly share code, notes, and snippets.

@jarnheimer
Last active June 16, 2020 14:24
Show Gist options
  • Save jarnheimer/3a91831e0f0e041fc5f838ebfe37d61d to your computer and use it in GitHub Desktop.
Save jarnheimer/3a91831e0f0e041fc5f838ebfe37d61d to your computer and use it in GitHub Desktop.
Refactoring code test PHP
<?php
/**
* Is the bar open
*
* @return bool
*/
function isBarOpen($day)
{
if ($day) {
if (is_string($day)) {
if ($day == 'friday' || $day == 'Friday') {
return true;
} elseif ($day == 'saturday' || $day == 'Saturday') {
return true;
} elseif ($day == 'sunday' || $day == 'Sunday') {
return true;
} else {
return 0;
}
} else {
return 0;
}
} else {
return 0;
}
}
@jarnheimer
Copy link
Author

Backward compatibility is not required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment