round() public method

"Rounds" the Decimal to have at most $scale digits after the point
public round ( integer $scale ) : Decimal
$scale integer
return Decimal
コード例 #1
0
ファイル: Money.php プロジェクト: coolms/money
 /**
  * Useful for payment systems that don't use high precision
  *
  * @param int $roundingMode
  * @return Decimal
  */
 public function toUnits($roundingMode = self::ROUND_HALF_UP)
 {
     $this->assertRoundingMode($roundingMode);
     $precision = $this->getPrecision();
     if (null === $roundingMode) {
         return $this->amount->round($precision);
     }
     return Math::bcround($this->amount, $precision, $roundingMode);
 }