public function testCreate()
 {
     $this->assertInstanceOf('\\Symfony\\Component\\Intl\\NumberFormatter\\NumberFormatter', NumberFormatter::create('en', NumberFormatter::DECIMAL));
 }
Beispiel #2
-1
 /**
  * Returns a rounded string with the currency symbol
  *
  * @param bool $displayCountryForUS Set to true if you would like 'US$' instead of just '$'
  * @return string
  */
 public function format($displayCountryForUS = false)
 {
     $formatter = new NumberFormatter('en', NumberFormatter::CURRENCY);
     if ($displayCountryForUS && $this->currency === 'USD') {
         if ($this->amount >= 0) {
             return 'US' . $formatter->formatCurrency($this->amount, $this->currency);
         }
         return '-US' . $formatter->formatCurrency(-$this->amount, $this->currency);
     }
     return $formatter->formatCurrency($this->amount, $this->currency);
 }