Esempio n. 1
0
 /**
  * Resets the configuration of the class
  *
  * @internal
  *
  * @return void
  */
 public static function reset()
 {
     self::$format_callback = NULL;
     self::$unformat_callback = NULL;
 }
Esempio n. 2
0
 /**
  * Subtracts the passed monetary value from the current one
  * 
  * @throws fValidationException  When `$subtrahend` is not a valid number/monetary value
  * 
  * @param  fMoney|string|integer $subtrahend  The money object to subtract - a string or integer will be converted to the default currency (if defined)
  * @return fMoney  The difference of the monetary values in this currency
  */
 public function sub($subtrahend)
 {
     $subtrahend = $this->makeMoney($subtrahend);
     $converted_subtrahend = $subtrahend->convert($this->currency)->amount;
     $precision = self::getCurrencyInfo($this->currency, 'precision');
     $new_amount = $this->amount->sub($converted_subtrahend, $precision + 1)->round($precision);
     return new fMoney($new_amount, $this->currency);
 }
Esempio n. 3
0
 /**
  * @dataProvider truncProvider
  */
 public function testTrunc($input, $scale, $output)
 {
     $num = new fNumber($input);
     $this->assertSame($output, $num->trunc($scale)->__toString());
 }