Skip to content

Commit

Permalink
BackwardsCompatibilityBreak - fMoney::multiply() is now fMoney::mul()…
Browse files Browse the repository at this point in the history
… and fMoney::subtract() is now fMoney::sub(), makes fMoney and fNumber APIs consistent and fixes ticket #53
  • Loading branch information
wbond committed Apr 12, 2012
1 parent 5fc2aa3 commit 980845c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/ecommerce/fMoney.php
Expand Up @@ -487,7 +487,7 @@ public function lte(fMoney $money)
* @param fNumber|string $multiplicand The number of times to multiply this ammount - don't use a float since they are imprecise * @param fNumber|string $multiplicand The number of times to multiply this ammount - don't use a float since they are imprecise
* @return fMoney The product of the monetary value and the multiplicand passed * @return fMoney The product of the monetary value and the multiplicand passed
*/ */
public function multiply($multiplicand) public function mul($multiplicand)
{ {
$new_amount = $this->amount->mul($multiplicand); $new_amount = $this->amount->mul($multiplicand);
return new fMoney($new_amount, $this->currency); return new fMoney($new_amount, $this->currency);
Expand All @@ -512,7 +512,7 @@ protected function round()
* @param fMoney $subtrahend The money object to subtract * @param fMoney $subtrahend The money object to subtract
* @return fMoney The difference of the monetary values in this currency * @return fMoney The difference of the monetary values in this currency
*/ */
public function subtract(fMoney $subtrahend) public function sub(fMoney $subtrahend)
{ {
$converted_subtrahend = $subtrahend->convert($this->currency)->amount; $converted_subtrahend = $subtrahend->convert($this->currency)->amount;
$new_amount = $this->amount->sub($converted_subtrahend); $new_amount = $this->amount->sub($converted_subtrahend);
Expand Down

0 comments on commit 980845c

Please sign in to comment.