예제 #1
0
 /**
  *
  * @param mixed $value            
  * @return \DateTime
  */
 public function __invoke($value)
 {
     $currency = new CurrencyFormat();
     $currency->setLocale('de_DE');
     $currency->setCurrencyCode('EUR');
     return $currency($value);
 }
예제 #2
0
 public function createService(ServiceLocatorInterface $sm)
 {
     $configManager = $sm->getServiceLocator()->get('Base\\Manager\\ConfigManager');
     $locale = $configManager->need('i18n.locale');
     $currency = $configManager->need('i18n.currency');
     $currencyFormat = new CurrencyFormat();
     $currencyFormat->setCurrencyCode($currency);
     $currencyFormat->setLocale($locale);
     return $currencyFormat;
 }
예제 #3
0
파일: Format.php 프로젝트: coolms/money
 /**
  * @return CurrencyFormat
  */
 protected function getCurrencyFormatter()
 {
     if ($this->currencyFormatter) {
         return $this->currencyFormatter;
     }
     if (method_exists($this->view, 'plugin')) {
         $this->currencyFormatter = $this->view->plugin($this->defaultCurrencyFormatter);
     }
     if (!$this->currencyFormatter instanceof CurrencyFormat) {
         $this->setCurrencyFormatter(new CurrencyFormat());
         $this->currencyFormatter->setView($this->getView());
     }
     return $this->currencyFormatter;
 }
예제 #4
0
 public function testDefaultLocale()
 {
     $this->assertMbStringEquals(Locale::getDefault(), $this->helper->getLocale());
 }
예제 #5
0
파일: Moeda.php 프로젝트: adaoex/zf2-base
 /**
  * Retorna número no formato brasileiro (locale: pt_BR, currency: BRL)
  * 
  * @param number $number 
  * @return string no formato brasileiro (locale: pt_BR, currency: BRL)
  */
 function formataBr($number)
 {
     return parent::__invoke($number, 'BRL', null, 'pt_BR', null);
 }
예제 #6
0
 public function getCurrencyFormatter()
 {
     $languageService = $this->locator->get('Application\\Service\\Language');
     $currentLanguage = $languageService->getCurrentLanguage();
     $formatter = new CurrencyFormat();
     $formatter->setLocale($currentLanguage->getLocale());
     return $formatter;
 }