formatter === null) { $this->formatter = new LocaleFormatter($this->localeService, $this->locale); } return $this->formatter; } public function getFormattedDateTime(\DateTime $date): string { return (string) $this->getFormatter()->dateShort($date); } public function getFormattedTime(\DateTime $date): string { return (string) $this->getFormatter()->time($date); } public function getFormattedMonthName(\DateTime $date): string { return $this->getFormatter()->monthName($date); } public function getFormattedMoney(float $amount, ?string $currency, bool $withCurrency = true): string { return $this->getFormatter()->money($amount, $currency, $withCurrency); } public function getFormattedDuration(int $seconds): string { return $this->getFormatter()->duration($seconds); } public function getFormattedDecimalDuration(int $seconds): string { return $this->getFormatter()->durationDecimal($seconds); } public function getCurrencySymbol(string $currency): string { return $this->getFormatter()->currency($currency); } public function getLocale(): string { return $this->locale; } public function setLocale(string $locale): void { $this->locale = $locale; $this->formatter = null; } }