|
@@ -23,7 +23,7 @@ discard block |
|
|
block discarded – undo |
|
23
|
23
|
$this->language = $language; |
|
24
|
24
|
} |
|
25
|
25
|
|
|
26
|
|
- public function number(int|float $value, int $precision = 2) |
|
|
26
|
+ public function number(int | float $value, int $precision = 2) |
|
27
|
27
|
{ |
|
28
|
28
|
// The fallback implementation in Intl only supports DECIMAL, so we hardcode the style here.. |
|
29
|
29
|
$formatter = new NumberFormatter($this->get_locale(), NumberFormatter::DECIMAL); |
|
@@ -31,7 +31,7 @@ discard block |
|
|
block discarded – undo |
|
31
|
31
|
return $formatter->format($value); |
|
32
|
32
|
} |
|
33
|
33
|
|
|
34
|
|
- public function amount(int|float $value) |
|
|
34
|
+ public function amount(int | float $value) |
|
35
|
35
|
{ |
|
36
|
36
|
// The fallback implementation in Intl only supports DECIMAL, so we hardcode the style here.. |
|
37
|
37
|
$formatter = new NumberFormatter($this->get_locale(), NumberFormatter::DECIMAL); |
|
@@ -40,24 +40,24 @@ discard block |
|
|
block discarded – undo |
|
40
|
40
|
return $formatter->format($value); |
|
41
|
41
|
} |
|
42
|
42
|
|
|
43
|
|
- public function date(int|string|null|DateTimeInterface $value = null, int|string $dateformat = 'medium') |
|
|
43
|
+ public function date(int | string | null | DateTimeInterface $value = null, int | string $dateformat = 'medium') |
|
44
|
44
|
{ |
|
45
|
45
|
return $this->datetime($value, $dateformat, IntlDateFormatter::NONE); |
|
46
|
46
|
} |
|
47
|
47
|
|
|
48
|
|
- public function time(int|string|null|DateTimeInterface $value = null, int|string $timeformat = 'short') |
|
|
48
|
+ public function time(int | string | null | DateTimeInterface $value = null, int | string $timeformat = 'short') |
|
49
|
49
|
{ |
|
50
|
50
|
return $this->datetime($value, IntlDateFormatter::NONE, $timeformat); |
|
51
|
51
|
} |
|
52
|
52
|
|
|
53
|
|
- public function datetime(int|string|null|DateTimeInterface $value = null, int|string $dateformat = 'medium', int|string $timeformat = 'short') |
|
|
53
|
+ public function datetime(int | string | null | DateTimeInterface $value = null, int | string $dateformat = 'medium', int | string $timeformat = 'short') |
|
54
|
54
|
{ |
|
55
|
55
|
$value ??= time(); |
|
56
|
56
|
$formatter = new IntlDateFormatter($this->get_locale(), $this->constant($dateformat), $this->constant($timeformat)); |
|
57
|
57
|
return $formatter->format($value); |
|
58
|
58
|
} |
|
59
|
59
|
|
|
60
|
|
- public function customdate(int|string|DateTimeInterface $value, string $pattern) |
|
|
60
|
+ public function customdate(int | string | DateTimeInterface $value, string $pattern) |
|
61
|
61
|
{ |
|
62
|
62
|
$formatter = new IntlDateFormatter($this->get_locale(), IntlDateFormatter::FULL, IntlDateFormatter::FULL); |
|
63
|
63
|
$formatter->setPattern($pattern); |
|
@@ -79,7 +79,7 @@ discard block |
|
|
block discarded – undo |
|
79
|
79
|
return $ranger->format($start, $end); |
|
80
|
80
|
} |
|
81
|
81
|
|
|
82
|
|
- private function constant(int|string $input) : int |
|
|
82
|
+ private function constant(int | string $input) : int |
|
83
|
83
|
{ |
|
84
|
84
|
if (is_int($input)) { |
|
85
|
85
|
return $input; |