@@ -64,7 +64,7 @@ |
||
64 | 64 | * @param string $format |
65 | 65 | * @return string|mixed |
66 | 66 | */ |
67 | - public static function date(string|DateTimeInterface|int|null $variable, string $format): mixed |
|
67 | + public static function date(string | DateTimeInterface | int | null $variable, string $format): mixed |
|
68 | 68 | { |
69 | 69 | if ($variable === null) { |
70 | 70 | return null; |
@@ -56,8 +56,7 @@ |
||
56 | 56 | * @class DatetimeFilter |
57 | 57 | * @package Platine\Template\Filter |
58 | 58 | */ |
59 | -class DatetimeFilter extends AbstractFilter |
|
60 | -{ |
|
59 | +class DatetimeFilter extends AbstractFilter { |
|
61 | 60 | /** |
62 | 61 | * Formats a date |
63 | 62 | * @param string|DateTimeInterface|int|null $variable |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param float|int $operand |
64 | 64 | * @return float|int |
65 | 65 | */ |
66 | - public static function plus(float|int $variable, float|int $operand): float|int |
|
66 | + public static function plus(float | int $variable, float | int $operand): float | int |
|
67 | 67 | { |
68 | 68 | if (is_float($operand) || is_float($variable)) { |
69 | 69 | return (float) $variable + (float) $operand; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param float|int $operand |
79 | 79 | * @return float|int |
80 | 80 | */ |
81 | - public static function minus(float|int $variable, float|int $operand): float|int |
|
81 | + public static function minus(float | int $variable, float | int $operand): float | int |
|
82 | 82 | { |
83 | 83 | if (is_float($operand) || is_float($variable)) { |
84 | 84 | return (float) $variable - (float) $operand; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * @param float|int $operand |
94 | 94 | * @return float|int |
95 | 95 | */ |
96 | - public static function times(float|int $variable, float|int $operand): float|int |
|
96 | + public static function times(float | int $variable, float | int $operand): float | int |
|
97 | 97 | { |
98 | 98 | if (is_float($operand) || is_float($variable)) { |
99 | 99 | return (float) $variable * (float) $operand; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param float|int $operand |
109 | 109 | * @return int|float |
110 | 110 | */ |
111 | - public static function modulo(float|int $variable, float|int $operand): float|int |
|
111 | + public static function modulo(float | int $variable, float | int $operand): float | int |
|
112 | 112 | { |
113 | 113 | if (is_float($operand) || is_float($variable)) { |
114 | 114 | return fmod((float) $variable, (float) $operand); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param float|int $operand |
124 | 124 | * @return int|float |
125 | 125 | */ |
126 | - public static function div(float|int $variable, float|int $operand): float|int |
|
126 | + public static function div(float | int $variable, float | int $operand): float | int |
|
127 | 127 | { |
128 | 128 | if ($operand == 0) {// don't use === |
129 | 129 | return $variable; |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @param int $number |
143 | 143 | * @return float |
144 | 144 | */ |
145 | - public static function round(float|int $variable, int $number = 0): float |
|
145 | + public static function round(float | int $variable, int $number = 0): float |
|
146 | 146 | { |
147 | 147 | return round((float) $variable, (int) $number); |
148 | 148 | } |
@@ -156,8 +156,8 @@ discard block |
||
156 | 156 | * @return string |
157 | 157 | */ |
158 | 158 | public static function format( |
159 | - float|int|string|null $variable, |
|
160 | - int|string $decimal = 0, |
|
159 | + float | int | string | null $variable, |
|
160 | + int | string $decimal = 0, |
|
161 | 161 | string $decimalPoint = '.', |
162 | 162 | string $separator = ',' |
163 | 163 | ): string { |
@@ -182,8 +182,8 @@ discard block |
||
182 | 182 | * @return string |
183 | 183 | */ |
184 | 184 | public static function formatMoney( |
185 | - float|int|string|null $variable, |
|
186 | - int|string $decimal = 0, |
|
185 | + float | int | string | null $variable, |
|
186 | + int | string $decimal = 0, |
|
187 | 187 | string $decimalPoint = '.', |
188 | 188 | string $separator = ',' |
189 | 189 | ): string { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param float|int|string|null $variable |
210 | 210 | * @return string |
211 | 211 | */ |
212 | - public static function numberToString(float|int|string|null $variable): string |
|
212 | + public static function numberToString(float | int | string | null $variable): string |
|
213 | 213 | { |
214 | 214 | $value = (string) $variable; |
215 | 215 | if (stripos($value, 'e') !== false) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | } else { |
224 | 224 | $arr = explode('.', $base); |
225 | 225 | } |
226 | - $separator = '%.' . (string)(strlen($arr[1]) + (abs((int)$decimal) - 1)) . 'f'; |
|
226 | + $separator = '%.' . (string) (strlen($arr[1]) + (abs((int) $decimal) - 1)) . 'f'; |
|
227 | 227 | |
228 | 228 | $value = sprintf($separator, $variable); |
229 | 229 | } |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | * @return float|int|string |
239 | 239 | */ |
240 | 240 | public static function sizeFormat( |
241 | - float|int|string|null $variable, |
|
242 | - int|string $precision = 2 |
|
243 | - ): float|int|string { |
|
241 | + float | int | string | null $variable, |
|
242 | + int | string $precision = 2 |
|
243 | + ): float | int | string { |
|
244 | 244 | if (is_numeric($variable) === false) { |
245 | 245 | return $variable; |
246 | 246 | } |