예제 #1
0
 /**
  * @param Decimal2 $amount
  * @return string
  */
 public function format(Decimal2 $amount)
 {
     switch ($this->code) {
         case 'JPY':
             return self::separateThousands(strval($amount->integerValue()), ',');
         case 'EUR':
         case 'GBP':
             return self::separateThousands(strval($amount->integerValue()), '.') . ',' . substr(strval($amount), -2);
         case 'CHF':
         case 'USD':
             return self::separateThousands(strval($amount->integerValue()), ',') . '.' . substr(strval($amount), -2);
         default:
             return strval($amount);
     }
 }
예제 #2
0
 /**
  * @param Decimal2 $d
  * @param integer $int
  * @param integer $fraction
  * @param string $strRep
  */
 private function assertD($d, $int, $fraction, $strRep)
 {
     $this->assertEquals($int, $d->integerValue());
     $this->assertEquals($fraction, $d->fractionValue());
     $this->assertEquals($strRep, strval($d));
 }