@@ -55,16 +55,14 @@ discard block |
||
55 | 55 | * Class NumberFilter |
56 | 56 | * @package Platine\Template\Filter |
57 | 57 | */ |
58 | -class NumberFilter extends AbstractFilter |
|
59 | -{ |
|
58 | +class NumberFilter extends AbstractFilter { |
|
60 | 59 | /** |
61 | 60 | * Addition |
62 | 61 | * @param mixed $variable |
63 | 62 | * @param mixed $operand |
64 | 63 | * @return float|int|mixed |
65 | 64 | */ |
66 | - public static function plus($variable, $operand) |
|
67 | - { |
|
65 | + public static function plus($variable, $operand) { |
|
68 | 66 | if (!is_numeric($variable) || !is_numeric($operand)) { |
69 | 67 | return $variable; |
70 | 68 | } |
@@ -82,8 +80,7 @@ discard block |
||
82 | 80 | * @param mixed $operand |
83 | 81 | * @return int|float|mixed |
84 | 82 | */ |
85 | - public static function minus($variable, $operand) |
|
86 | - { |
|
83 | + public static function minus($variable, $operand) { |
|
87 | 84 | if (!is_numeric($variable) || !is_numeric($operand)) { |
88 | 85 | return $variable; |
89 | 86 | } |
@@ -101,8 +98,7 @@ discard block |
||
101 | 98 | * @param mixed $operand |
102 | 99 | * @return int|float|mixed |
103 | 100 | */ |
104 | - public static function times($variable, $operand) |
|
105 | - { |
|
101 | + public static function times($variable, $operand) { |
|
106 | 102 | if (!is_numeric($variable) || !is_numeric($operand)) { |
107 | 103 | return $variable; |
108 | 104 | } |
@@ -120,8 +116,7 @@ discard block |
||
120 | 116 | * @param mixed $operand |
121 | 117 | * @return int|float|mixed |
122 | 118 | */ |
123 | - public static function modulo($variable, $operand) |
|
124 | - { |
|
119 | + public static function modulo($variable, $operand) { |
|
125 | 120 | if (!is_numeric($variable) || !is_numeric($operand)) { |
126 | 121 | return $variable; |
127 | 122 | } |
@@ -139,8 +134,7 @@ discard block |
||
139 | 134 | * @param mixed $operand |
140 | 135 | * @return int|float|mixed |
141 | 136 | */ |
142 | - public static function div($variable, $operand) |
|
143 | - { |
|
137 | + public static function div($variable, $operand) { |
|
144 | 138 | if (!is_numeric($variable) || !is_numeric($operand) || $operand == 0) { |
145 | 139 | return $variable; |
146 | 140 | } |
@@ -158,8 +152,7 @@ discard block |
||
158 | 152 | * @param mixed $number |
159 | 153 | * @return float|mixed |
160 | 154 | */ |
161 | - public static function round($variable, $number = 0) |
|
162 | - { |
|
155 | + public static function round($variable, $number = 0) { |
|
163 | 156 | if (!is_numeric($variable) || !is_numeric($number)) { |
164 | 157 | return $variable; |
165 | 158 | } |
@@ -229,8 +222,7 @@ discard block |
||
229 | 222 | * @param mixed $variable |
230 | 223 | * @return string|mixed |
231 | 224 | */ |
232 | - public static function numberToString($variable) |
|
233 | - { |
|
225 | + public static function numberToString($variable) { |
|
234 | 226 | $value = (string) $variable; |
235 | 227 | if (stripos($value, 'e') !== false) { |
236 | 228 | // PHP use scientific notation if decimal has 4 zeros |
@@ -243,7 +243,7 @@ |
||
243 | 243 | } else { |
244 | 244 | $arr = explode('.', $base); |
245 | 245 | } |
246 | - $separator = '%.' . (string)(strlen($arr[1]) + (abs((int)$decimal) - 1)) . 'f'; |
|
246 | + $separator = '%.' . (string) (strlen($arr[1]) + (abs((int) $decimal) - 1)) . 'f'; |
|
247 | 247 | |
248 | 248 | $value = sprintf($separator, $variable); |
249 | 249 | } |