src/DateFormat.php
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];
    }
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];
    }
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 ] ; }
Returns a IntlDateFormatter object
@param string $formatter The name of the formatter pattern
@param string $locale The locale. Defaults to default locale.
@return \IntlDateFormatter The formatter object
@throws \InvalidArgumentException If the locale or formatter name is invalid.
Returns a IntlDateFormatter object