1 | <?php |
||
15 | class Formatter |
||
16 | { |
||
17 | const FORMATTER_CURRENCY = 'currency'; |
||
18 | const FORMATTER_NUMBER = 'number'; |
||
19 | const FORMATTER_UNIT = 'unit'; |
||
20 | |||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected static $formattersMap = [ |
||
25 | self::FORMATTER_CURRENCY => 'Formatter\CurrencyFormatter', |
||
26 | self::FORMATTER_NUMBER => 'Formatter\NumberFormatter', |
||
27 | self::FORMATTER_UNIT => 'Formatter\UnitFormatter', |
||
28 | ]; |
||
29 | |||
30 | /** |
||
31 | * @param string $formatter_name |
||
32 | * |
||
33 | * @throws Exception\InvalidArgumentException |
||
34 | * |
||
35 | * @return \Soluble\FlexStore\Formatter\FormatterInterface |
||
36 | */ |
||
37 | 3 | public static function create($formatter_name, array $params = []) |
|
46 | |||
47 | /** |
||
48 | * Whether a formatter is supported. |
||
49 | * |
||
50 | * @param string $formatter_name |
||
51 | * |
||
52 | * @return bool |
||
53 | */ |
||
54 | 3 | public static function isSupported($formatter_name) |
|
58 | |||
59 | /** |
||
60 | * Return supported formatters. |
||
61 | * |
||
62 | * @return array |
||
63 | */ |
||
64 | 1 | public static function getSupported() |
|
68 | } |
||
69 |