3 * Copyright (c) 2014, Facebook, Inc.
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the "hack" directory of this source tree.
10 class NumberFormatter {
12 const PATTERN_DECIMAL = 0 ;
16 const SCIENTIFIC = 4 ;
20 const PATTERN_RULEBASED = 8 ;
22 const DEFAULT_STYLE = 10;
23 const ROUND_CEILING = 11;
24 const ROUND_FLOOR = 12;
25 const ROUND_DOWN = 13;
27 const ROUND_HALFEVEN = 15;
28 const ROUND_HALFDOWN = 16;
29 const ROUND_HALFUP = 17;
30 const PAD_BEFORE_PREFIX = 18;
31 const PAD_AFTER_PREFIX = 19;
32 const PAD_BEFORE_SUFFIX = 20;
33 const PAD_AFTER_SUFFIX = 21;
34 const PARSE_INT_ONLY = 22;
35 const GROUPING_USED = 23;
36 const DECIMAL_ALWAYS_SHOWN = 24;
37 const MAX_INTEGER_DIGITS = 25;
38 const MIN_INTEGER_DIGITS = 26;
39 const INTEGER_DIGITS = 27;
40 const MAX_FRACTION_DIGITS = 28;
41 const MIN_FRACTION_DIGITS = 29;
42 const FRACTION_DIGITS = 30;
43 const MULTIPLIER = 31;
44 const GROUPING_SIZE = 32;
45 const ROUNDING_MODE = 33;
46 const ROUNDING_INCREMENT = 34;
47 const FORMAT_WIDTH = 35;
48 const PADDING_POSITION = 36;
49 const SECONDARY_GROUPING_SIZE = 37;
50 const SIGNIFICANT_DIGITS_USED = 38;
51 const MIN_SIGNIFICANT_DIGITS = 39;
52 const MAX_SIGNIFICANT_DIGITS = 40;
53 const LENIENT_PARSE = 41;
54 const POSITIVE_PREFIX = 42;
55 const POSITIVE_SUFFIX = 43;
56 const NEGATIVE_PREFIX = 44;
57 const NEGATIVE_SUFFIX = 45;
58 const PADDING_CHARACTER = 46;
59 const CURRENCY_CODE = 47;
60 const DEFAULT_RULESET = 48;
61 const PUBLIC_RULESETS = 49;
62 const DECIMAL_SEPARATOR_SYMBOL = 50;
63 const GROUPING_SEPARATOR_SYMBOL = 51;
64 const PATTERN_SEPARATOR_SYMBOL = 52;
65 const PERCENT_SYMBOL = 53;
66 const ZERO_DIGIT_SYMBOL = 54;
67 const DIGIT_SYMBOL = 55;
68 const MINUS_SIGN_SYMBOL = 56;
69 const PLUS_SIGN_SYMBOL = 57;
70 const CURRENCY_SYMBOL = 58;
71 const INTL_CURRENCY_SYMBOL = 59;
72 const MONETARY_SEPARATOR_SYMBOL = 60;
73 const EXPONENTIAL_SYMBOL = 61;
74 const PERMILL_SYMBOL = 62;
75 const PAD_ESCAPE_SYMBOL = 63;
76 const INFINITY_SYMBOL = 64;
77 const NAN_SYMBOL = 65;
78 const SIGNIFICANT_DIGIT_SYMBOL = 66;
79 const MONETARY_GROUPING_SEPARATOR_SYMBOL = 67;
80 const TYPE_DEFAULT = 68;
81 const TYPE_INT32 = 69;
82 const TYPE_INT64 = 70;
83 const TYPE_DOUBLE = 71;
84 const TYPE_CURRENCY = 72;
87 public function __construct(string $locale, int $style, string $pattern = "#,##0.###");
88 <<__Rx, __MaybeMutable>>
89 public function formatCurrency(float $value, string $currency) : string;
90 <<__Rx, __MaybeMutable>>
91 public function format(mixed $value, int $type = NumberFormatter::TYPE_DEFAULT) : string;
92 <<__Rx, __MaybeMutable>>
93 public function getAttribute(int $attr) : int;
94 <<__Rx, __MaybeMutable>>
95 public function getErrorCode() : int;
96 <<__Rx, __MaybeMutable>>
97 public function getErrorMessage() : string;
98 <<__Rx, __MaybeMutable>>
99 public function getLocale(int $type = Locale::ACTUAL_LOCALE) : string;
100 <<__Rx, __MaybeMutable>>
101 public function getPattern() : string;
102 <<__Rx, __MaybeMutable>>
103 public function getSymbol(int $attr) : string;
104 <<__Rx, __MaybeMutable>>
105 public function getTextAttribute(int $attr) : string;
106 public function parseCurrency(string $value, string &$currency, int &$position = 0) : float;
107 public function parse(string $value, int $type = NumberFormatter::TYPE_DOUBLE, int &$position = 0) : mixed;
109 public function setAttribute(int $attr, int $value) : bool;
111 public function setPattern(string $pattern) : bool;
113 public function setSymbol(int $attr, string $value) : bool;
115 public function setTextAttribute(int $attr, string $value) : bool;