コード例 #1
0
ファイル: Currency.php プロジェクト: mehrweb/mwadmin
 /**
  *
  * @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
ファイル: CurrencyFormatTest.php プロジェクト: pnaq57/zf2demo
 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;
 }