public static function formatter($options = [])
    {
        $locale = isset($options['locale']) ? $options['locale'] : ini_get('intl.default_locale');

        if (!$locale) {
            $locale = static::DEFAULT_LOCALE;
        }

        $type = NumberFormatter::DECIMAL;
        if (!empty($options['type'])) {
            $type = $options['type'];
            if ($options['type'] === static::FORMAT_CURRENCY) {
                $type = NumberFormatter::CURRENCY;
            }
        }

        if (!isset(static::$_formatters[$locale][$type])) {
            static::$_formatters[$locale][$type] = new NumberFormatter($locale, $type);
        }

        $formatter = static::$_formatters[$locale][$type];

        $options = array_intersect_key($options, [
            'places' => null,
            'precision' => null,
            'pattern' => null,
            'useIntlCode' => null
        ]);
        if (empty($options)) {
            return $formatter;
        }

        $formatter = clone $formatter;

        return static::_setAttributes($formatter, $options);
    }