Created
November 3, 2019 16:00
-
-
Save hungtrinh/7ad8e1df263fbde50801a7df0fe5c4ee to your computer and use it in GitHub Desktop.
Final Production Code (Testable)
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 discountRateByMembershipType ($membershipType) { | |
if ('platinum' === $membershipType) return 0.15; | |
if ('gold' === $membershipType) return 0.1; | |
if ('silver' === $membershipType) return 0.05; | |
throw new UnexpectedValueException('invalid membership type'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment