Last active
April 15, 2017 17:25
-
-
Save craig-davis/a1f67c8a30b0b44fa242697dc52c3d51 to your computer and use it in GitHub Desktop.
Code Without Else with an Inverted Control
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 calculateSalePrice($item, $discount = 0) { | |
if ($discount > 0) { | |
return calculateDiscountedPrice($item->getPrice, $discount); | |
} | |
return $item->getPrice(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment