@@ -58,15 +58,13 @@ discard block |
||
| 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 |
| 66 | 65 | * @return mixed |
| 67 | 66 | */ |
| 68 | - public static function first($value) |
|
| 69 | - { |
|
| 67 | + public static function first($value) { |
|
| 70 | 68 | if (is_array($value)) { |
| 71 | 69 | return reset($value); |
| 72 | 70 | } |
@@ -85,8 +83,7 @@ discard block |
||
| 85 | 83 | * @param array<mixed>|Traversable<mixed>|mixed $value |
| 86 | 84 | * @return mixed |
| 87 | 85 | */ |
| 88 | - public static function last($value) |
|
| 89 | - { |
|
| 86 | + public static function last($value) { |
|
| 90 | 87 | if (is_array($value)) { |
| 91 | 88 | return end($value); |
| 92 | 89 | } |
@@ -109,8 +106,7 @@ discard block |
||
| 109 | 106 | * @param mixed $property |
| 110 | 107 | * @return mixed |
| 111 | 108 | */ |
| 112 | - public static function sort($variable, $property = null) |
|
| 113 | - { |
|
| 109 | + public static function sort($variable, $property = null) { |
|
| 114 | 110 | if ($variable instanceof Traversable) { |
| 115 | 111 | $variable = iterator_to_array($variable); |
| 116 | 112 | } |
@@ -134,8 +130,7 @@ discard block |
||
| 134 | 130 | * @param array<int|string, mixed>|mixed $variable |
| 135 | 131 | * @return mixed |
| 136 | 132 | */ |
| 137 | - public static function sortKey($variable) |
|
| 138 | - { |
|
| 133 | + public static function sortKey($variable) { |
|
| 139 | 134 | if (is_array($variable)) { |
| 140 | 135 | ksort($variable); |
| 141 | 136 | return $variable; |
@@ -149,8 +144,7 @@ discard block |
||
| 149 | 144 | * @param array<int|string, mixed>|mixed $variable |
| 150 | 145 | * @return mixed |
| 151 | 146 | */ |
| 152 | - public static function unique($variable) |
|
| 153 | - { |
|
| 147 | + public static function unique($variable) { |
|
| 154 | 148 | if ($variable instanceof Traversable) { |
| 155 | 149 | $variable = iterator_to_array($variable); |
| 156 | 150 | } |
@@ -164,8 +158,7 @@ discard block |
||
| 164 | 158 | * @param mixed $property |
| 165 | 159 | * @return string|mixed |
| 166 | 160 | */ |
| 167 | - public static function map($variable, $property) |
|
| 168 | - { |
|
| 161 | + public static function map($variable, $property) { |
|
| 169 | 162 | if ($variable instanceof Traversable) { |
| 170 | 163 | $variable = iterator_to_array($variable); |
| 171 | 164 | } |
@@ -191,8 +184,7 @@ discard block |
||
| 191 | 184 | * @param array<mixed>|Traversable|mixed $variable |
| 192 | 185 | * @return string|mixed |
| 193 | 186 | */ |
| 194 | - public static function reverse($variable) |
|
| 195 | - { |
|
| 187 | + public static function reverse($variable) { |
|
| 196 | 188 | if ($variable instanceof Traversable) { |
| 197 | 189 | $variable = iterator_to_array($variable); |
| 198 | 190 | } |
@@ -210,8 +202,7 @@ discard block |
||
| 210 | 202 | * @param mixed $pretty whether use pretty print |
| 211 | 203 | * @return string |
| 212 | 204 | */ |
| 213 | - public static function json($variable, $pretty = false) |
|
| 214 | - { |
|
| 205 | + public static function json($variable, $pretty = false) { |
|
| 215 | 206 | $prettyPrint = boolval($pretty); |
| 216 | 207 | $options = 0; |
| 217 | 208 | if ($prettyPrint) { |