@@ -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 | |
@@ -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)) { |
@@ -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 $variable, |
|
| 160 | - int|string $decimal = 0, |
|
| 159 | + float | int | string $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 $variable, |
|
| 186 | - int|string $decimal = 0, |
|
| 185 | + float | int | string $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 $variable |
| 210 | 210 | * @return string |
| 211 | 211 | */ |
| 212 | - public static function numberToString(float|int|string $variable): string |
|
| 212 | + public static function numberToString(float | int | string $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 $variable, |
|
| 242 | - int|string $precision = 2 |
|
| 243 | - ): float|int|string { |
|
| 241 | + float | int | string $variable, |
|
| 242 | + int | string $precision = 2 |
|
| 243 | + ): float | int | string { |
|
| 244 | 244 | if (!is_numeric($variable)) { |
| 245 | 245 | return $variable; |
| 246 | 246 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public static function truncate( |
| 157 | 157 | string $variable, |
| 158 | - int|string $count = 100, |
|
| 158 | + int | string $count = 100, |
|
| 159 | 159 | string $ending = '...' |
| 160 | 160 | ): string { |
| 161 | 161 | $numberChar = (int) $count; |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public static function truncateWord( |
| 177 | 177 | string $variable, |
| 178 | - int|string $count = 3, |
|
| 178 | + int | string $count = 3, |
|
| 179 | 179 | string $ending = '...' |
| 180 | 180 | ): string { |
| 181 | 181 | if (!is_numeric($count)) { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @param mixed $variable |
| 231 | 231 | * @return array<mixed>|string |
| 232 | 232 | */ |
| 233 | - public static function stringfy(mixed $variable): array|string |
|
| 233 | + public static function stringfy(mixed $variable): array | string |
|
| 234 | 234 | { |
| 235 | 235 | if (is_array($variable)) { |
| 236 | 236 | return $variable; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @param string $value |
| 262 | 262 | * @return int|false |
| 263 | 263 | */ |
| 264 | - public static function find(string $variable, string $value): int|false |
|
| 264 | + public static function find(string $variable, string $value): int | false |
|
| 265 | 265 | { |
| 266 | 266 | return strpos($variable, $value); |
| 267 | 267 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | return (string) preg_replace_callback( |
| 362 | 362 | '/(^|[^\p{L}\'])([\p{Ll}])/u', |
| 363 | - function ($matches) { |
|
| 363 | + function($matches) { |
|
| 364 | 364 | return $matches[1] . ucfirst($matches[2]); |
| 365 | 365 | }, |
| 366 | 366 | ucwords($variable) |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * @param string $format |
| 65 | 65 | * @return string|mixed |
| 66 | 66 | */ |
| 67 | - public static function date(string|DateTimeInterface|int $variable, string $format): mixed |
|
| 67 | + public static function date(string | DateTimeInterface | int $variable, string $format): mixed |
|
| 68 | 68 | { |
| 69 | 69 | if ($variable instanceof DateTimeInterface) { |
| 70 | 70 | return $variable->format($format); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * The loop start value |
| 104 | 104 | * @var int|string |
| 105 | 105 | */ |
| 106 | - protected int|string $start; |
|
| 106 | + protected int | string $start; |
|
| 107 | 107 | |
| 108 | 108 | /** |
| 109 | 109 | * {@inheritdoc} |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | 'index0' => $index, |
| 195 | 195 | 'rindex' => $length - $index, |
| 196 | 196 | 'rindex0' => $length - $index - 1, |
| 197 | - 'first' => ((int)$index === 0), |
|
| 198 | - 'last' => ((int)$index === ($length - 1)), |
|
| 197 | + 'first' => ((int) $index === 0), |
|
| 198 | + 'last' => ((int) $index === ($length - 1)), |
|
| 199 | 199 | ]); |
| 200 | 200 | |
| 201 | 201 | $result .= $this->renderAll($this->nodeList, $context); |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $offset = 0; |
| 245 | 245 | if (isset($this->attributes['offset'])) { |
| 246 | 246 | $forRegister = $context->getRegister('for'); |
| 247 | - $offset = ($this->attributes['offset'] === 'continue') |
|
| 247 | + $offset = ($this->attributes['offset'] === 'continue') |
|
| 248 | 248 | ? (isset($forRegister[$this->name]) |
| 249 | 249 | ? (int) $forRegister[$this->name] |
| 250 | 250 | : 0) |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | 'index0' => $index, |
| 282 | 282 | 'rindex' => $length - $index, |
| 283 | 283 | 'rindex0' => $length - $index - 1, |
| 284 | - 'first' => ((int)$index === 0), |
|
| 285 | - 'last' => ((int)$index === ($length - 1)), |
|
| 284 | + 'first' => ((int) $index === 0), |
|
| 285 | + 'last' => ((int) $index === ($length - 1)), |
|
| 286 | 286 | ]); |
| 287 | 287 | |
| 288 | 288 | $result .= $this->renderAll($this->nodeList, $context); |