Skip to content

Commit

Permalink
Money::dividedBy() now accepts an optional scale parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Jun 4, 2015
1 parent c8eb591 commit d870efb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "MIT",
"require": {
"php": ">=5.6",
"brick/math": "0.2.*"
"brick/math": "0.3.*"
},
"require-dev": {
"phpunit/phpunit": "*",
Expand Down
9 changes: 5 additions & 4 deletions src/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,15 @@ public function multipliedBy($that)
}

/**
* @param BigDecimal|number|string $that
* @param int $roundingMode
* @param BigDecimal|number|string $that The divisor.
* @param int $roundingMode The rounding mode to use.
* @param int|null $scale The desired scale, or null to use the current scale.
*
* @return Money
*/
public function dividedBy($that, $roundingMode = RoundingMode::UNNECESSARY)
public function dividedBy($that, $roundingMode = RoundingMode::UNNECESSARY, $scale = null)
{
return new Money($this->amount->dividedBy($that, null, $roundingMode), $this->currency);
return new Money($this->amount->dividedBy($that, $roundingMode, $scale), $this->currency);
}

/**
Expand Down

0 comments on commit d870efb

Please sign in to comment.