/** * * @param mixed $value * @return \DateTime */ public function __invoke($value) { $currency = new CurrencyFormat(); $currency->setLocale('de_DE'); $currency->setCurrencyCode('EUR'); return $currency($value); }
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; }
/** * @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; }
public function testDefaultLocale() { $this->assertMbStringEquals(Locale::getDefault(), $this->helper->getLocale()); }
/** * 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); }
public function getCurrencyFormatter() { $languageService = $this->locator->get('Application\\Service\\Language'); $currentLanguage = $languageService->getCurrentLanguage(); $formatter = new CurrencyFormat(); $formatter->setLocale($currentLanguage->getLocale()); return $formatter; }