Last active
June 16, 2020 14:24
-
-
Save jarnheimer/3a91831e0f0e041fc5f838ebfe37d61d to your computer and use it in GitHub Desktop.
Refactoring code test PHP
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 | |
/** | |
* 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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Backward compatibility is not required.