public function getFormatter(string $formatter, ?string $locale = null): \IntlDateFormatter
    {
        if ($locale === null) {
            $locale = $this->locale;
        }
        
        if (!isset($this->formatters[$locale])) {
            throw new \InvalidArgumentException('Locale data not found.');
        }
        
        if (!isset($this->formatters[$locale][$formatter])) {
            throw new \InvalidArgumentException('Formatter not found for specified locale.');
        }
        
        return $this->formatters[$locale][$formatter];
    }