original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Returns a formatter object that can be reused for similar formatting task
  under the same locale and options. This is often a speedier alternative to
  using other methods in this class as only one formatter object needs to be
  constructed.
  
  ### Options
  
  - `locale` - The locale name to use for formatting the number, e.g. fr_FR
  - `type` - The formatter type to construct, set it to `currency` if you need to format
  numbers representing money or a NumberFormatter constant.
  - `places` - Number of decimal places to use. e.g. 2
  - `precision` - Maximum Number of decimal places to use, e.g. 2
  - `pattern` - An ICU number pattern to use for formatting the number. e.g #,##0.00
  - `useIntlCode` - Whether or not to replace the currency symbol with the international
  currency code.
  
  @param array $options An array with options.
  @return \NumberFormatter The configured formatter instance
docstring_tokens: Returns a formatter object that can be reused for similar formatting task under the same locale and options . This is often a speedier alternative to using other methods in this class as only one formatter object needs to be constructed .