@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class LoaderInterface |
54 | 54 | * @package Platine\Template\Loader |
55 | 55 | */ |
56 | -interface LoaderInterface |
|
57 | -{ |
|
56 | +interface LoaderInterface { |
|
58 | 57 | /** |
59 | 58 | * Return the template content to be use |
60 | 59 | * for parse and rendering |
@@ -179,7 +179,7 @@ |
||
179 | 179 | * @param string|AbstractTag $class |
180 | 180 | * @return $this |
181 | 181 | */ |
182 | - public function addTag(string $name, string|AbstractTag $class): self |
|
182 | + public function addTag(string $name, string | AbstractTag $class): self |
|
183 | 183 | { |
184 | 184 | $this->tags[$name] = $class; |
185 | 185 |
@@ -61,8 +61,7 @@ |
||
61 | 61 | * @class Template |
62 | 62 | * @package Platine\Template |
63 | 63 | */ |
64 | -class Template |
|
65 | -{ |
|
64 | +class Template { |
|
66 | 65 | /** |
67 | 66 | * The configuration instance |
68 | 67 | * @var Configuration |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class NotFoundException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class NotFoundException extends LoaderException |
|
43 | -{ |
|
42 | +class NotFoundException extends LoaderException { |
|
44 | 43 | } |
@@ -41,6 +41,5 @@ |
||
41 | 41 | * @class TemplateException |
42 | 42 | * @package Platine\Template\Exception |
43 | 43 | */ |
44 | -class TemplateException extends Exception |
|
45 | -{ |
|
44 | +class TemplateException extends Exception { |
|
46 | 45 | } |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class ParseException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class ParseException extends TemplateException |
|
43 | -{ |
|
42 | +class ParseException extends TemplateException { |
|
44 | 43 | } |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class RenderException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class RenderException extends TemplateException |
|
43 | -{ |
|
42 | +class RenderException extends TemplateException { |
|
44 | 43 | } |
@@ -39,6 +39,5 @@ |
||
39 | 39 | * @class LoaderException |
40 | 40 | * @package Platine\Template\Exception |
41 | 41 | */ |
42 | -class LoaderException extends TemplateException |
|
43 | -{ |
|
42 | +class LoaderException extends TemplateException { |
|
44 | 43 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int|string|null $property |
110 | 110 | * @return mixed |
111 | 111 | */ |
112 | - public static function sort(mixed $variable, int|string|null $property = null): mixed |
|
112 | + public static function sort(mixed $variable, int | string | null $property = null): mixed |
|
113 | 113 | { |
114 | 114 | if ($variable instanceof Traversable) { |
115 | 115 | $variable = iterator_to_array($variable); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } else { |
121 | 121 | $first = reset($variable); |
122 | 122 | if ($first !== false && is_array($first) && array_key_exists($property, $first)) { |
123 | - uasort($variable, function ($a, $b) use ($property) { |
|
123 | + uasort($variable, function($a, $b) use ($property) { |
|
124 | 124 | return $a[$property] <=> $b[$property]; |
125 | 125 | }); |
126 | 126 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * @param int|string $property |
165 | 165 | * @return mixed |
166 | 166 | */ |
167 | - public static function map(mixed $variable, int|string $property): mixed |
|
167 | + public static function map(mixed $variable, int | string $property): mixed |
|
168 | 168 | { |
169 | 169 | if ($variable instanceof Traversable) { |
170 | 170 | $variable = iterator_to_array($variable); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | return array_map( |
178 | - function ($element) use ($property) { |
|
178 | + function($element) use ($property) { |
|
179 | 179 | if (is_callable($element)) { |
180 | 180 | return $element(); |
181 | 181 | } elseif (is_array($element) && array_key_exists($property, $element)) { |
@@ -58,8 +58,7 @@ |
||
58 | 58 | * @class ArrayFilter |
59 | 59 | * @package Platine\Template\Filter |
60 | 60 | */ |
61 | -class ArrayFilter extends AbstractFilter |
|
62 | -{ |
|
61 | +class ArrayFilter extends AbstractFilter { |
|
63 | 62 | /** |
64 | 63 | * Returns the first element of an array |
65 | 64 | * @param array<mixed>|Iterator<mixed>|mixed $value |
@@ -55,8 +55,7 @@ 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 float|int $variable |
@@ -125,7 +124,8 @@ discard block |
||
125 | 124 | */ |
126 | 125 | public static function div(float|int $variable, float|int $operand): float|int |
127 | 126 | { |
128 | - if ($operand == 0) {// don't use === |
|
127 | + if ($operand == 0) { |
|
128 | +// don't use === |
|
129 | 129 | return $variable; |
130 | 130 | } |
131 | 131 |
@@ -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|null |
239 | 239 | */ |
240 | 240 | public static function sizeFormat( |
241 | - float|int|string|null $variable, |
|
242 | - int|string $precision = 2 |
|
243 | - ): float|int|string|null { |
|
241 | + float | int | string | null $variable, |
|
242 | + int | string $precision = 2 |
|
243 | + ): float | int | string | null { |
|
244 | 244 | if (is_string($variable) && is_numeric($variable) === false) { |
245 | 245 | return $variable; |
246 | 246 | } |