@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | || |
33 | 33 | (is_object($array) && method_exists($array, '__toString')) |
34 | 34 | ) { |
35 | - $array = (array)$array; |
|
35 | + $array = (array) $array; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (!is_array($array)) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | |
182 | - return (array)$this->array; |
|
182 | + return (array) $this->array; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | - return self::create((array)$return); |
|
231 | + return self::create((array) $return); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $return = array($key); |
249 | 249 | } |
250 | 250 | |
251 | - return self::create((array)$return); |
|
251 | + return self::create((array) $return); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | public function clean() |
421 | 421 | { |
422 | 422 | return $this->filter( |
423 | - function ($value) { |
|
424 | - return (bool)$value; |
|
423 | + function($value) { |
|
424 | + return (bool) $value; |
|
425 | 425 | } |
426 | 426 | ); |
427 | 427 | } |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $array = array_splice($this->array, 0, $take, true); |
488 | 488 | } |
489 | 489 | |
490 | - return self::create((array)$array); |
|
490 | + return self::create((array) $array); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | public function last($take = null) |
501 | 501 | { |
502 | 502 | if ($take === null) { |
503 | - $array = self::create((array)array_pop($this->array)); |
|
503 | + $array = self::create((array) array_pop($this->array)); |
|
504 | 504 | } else { |
505 | 505 | $array = $this->rest(-$take); |
506 | 506 | } |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $array[$key] = $replacement; |
683 | 683 | } |
684 | 684 | |
685 | - return self::create((array)$array); |
|
685 | + return self::create((array) $array); |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -696,12 +696,12 @@ discard block |
||
696 | 696 | public function replaceValues($search, $replacement = '') |
697 | 697 | { |
698 | 698 | $array = $this->each( |
699 | - function ($value) use ($search, $replacement) { |
|
699 | + function($value) use ($search, $replacement) { |
|
700 | 700 | return UTF8::str_replace($search, $replacement, $value); |
701 | 701 | } |
702 | 702 | ); |
703 | 703 | |
704 | - return self::create((array)$array); |
|
704 | + return self::create((array) $array); |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | /** |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | { |
952 | 952 | $this->array = array_reduce( |
953 | 953 | $this->array, |
954 | - function ($resultArray, $value) { |
|
954 | + function($resultArray, $value) { |
|
955 | 955 | if (in_array($value, $resultArray, true) === false) { |
956 | 956 | $resultArray[] = $value; |
957 | 957 | } |
@@ -185,7 +185,7 @@ |
||
185 | 185 | /** |
186 | 186 | * get the current array from the "Arrayy"-object |
187 | 187 | * |
188 | - * @return array |
|
188 | + * @return null|callable |
|
189 | 189 | */ |
190 | 190 | public function getArray() |
191 | 191 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function has($key) |
30 | 30 | { |
31 | 31 | // Generate unique string to use as marker. |
32 | - $unFound = (string)uniqid('arrayy', true); |
|
32 | + $unFound = (string) uniqid('arrayy', true); |
|
33 | 33 | |
34 | 34 | return $this->get($key, $unFound) !== $unFound; |
35 | 35 | } |
@@ -151,47 +151,47 @@ discard block |
||
151 | 151 | } |
152 | 152 | |
153 | 153 | $ops = array( |
154 | - 'eq' => function ($item, $prop, $value) { |
|
154 | + 'eq' => function($item, $prop, $value) { |
|
155 | 155 | return $item[$prop] === $value; |
156 | 156 | }, |
157 | - 'gt' => function ($item, $prop, $value) { |
|
157 | + 'gt' => function($item, $prop, $value) { |
|
158 | 158 | return $item[$prop] > $value; |
159 | 159 | }, |
160 | - 'gte' => function ($item, $prop, $value) { |
|
160 | + 'gte' => function($item, $prop, $value) { |
|
161 | 161 | return $item[$prop] >= $value; |
162 | 162 | }, |
163 | - 'lt' => function ($item, $prop, $value) { |
|
163 | + 'lt' => function($item, $prop, $value) { |
|
164 | 164 | return $item[$prop] < $value; |
165 | 165 | }, |
166 | - 'lte' => function ($item, $prop, $value) { |
|
166 | + 'lte' => function($item, $prop, $value) { |
|
167 | 167 | return $item[$prop] <= $value; |
168 | 168 | }, |
169 | - 'ne' => function ($item, $prop, $value) { |
|
169 | + 'ne' => function($item, $prop, $value) { |
|
170 | 170 | return $item[$prop] !== $value; |
171 | 171 | }, |
172 | - 'contains' => function ($item, $prop, $value) { |
|
173 | - return in_array($item[$prop], (array)$value, true); |
|
172 | + 'contains' => function($item, $prop, $value) { |
|
173 | + return in_array($item[$prop], (array) $value, true); |
|
174 | 174 | }, |
175 | - 'notContains' => function ($item, $prop, $value) { |
|
176 | - return !in_array($item[$prop], (array)$value, true); |
|
175 | + 'notContains' => function($item, $prop, $value) { |
|
176 | + return !in_array($item[$prop], (array) $value, true); |
|
177 | 177 | }, |
178 | - 'newer' => function ($item, $prop, $value) { |
|
178 | + 'newer' => function($item, $prop, $value) { |
|
179 | 179 | return strtotime($item[$prop]) > strtotime($value); |
180 | 180 | }, |
181 | - 'older' => function ($item, $prop, $value) { |
|
181 | + 'older' => function($item, $prop, $value) { |
|
182 | 182 | return strtotime($item[$prop]) < strtotime($value); |
183 | 183 | }, |
184 | 184 | ); |
185 | 185 | |
186 | 186 | $result = array_values( |
187 | 187 | array_filter( |
188 | - (array)$this->array, function ($item) use ( |
|
188 | + (array) $this->array, function($item) use ( |
|
189 | 189 | $property, |
190 | 190 | $value, |
191 | 191 | $ops, |
192 | 192 | $comparisonOp |
193 | 193 | ) { |
194 | - $item = (array)$item; |
|
194 | + $item = (array) $item; |
|
195 | 195 | $item[$property] = $this->get($property, array(), $item); |
196 | 196 | |
197 | 197 | return $ops[$comparisonOp]($item, $property, $value); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | */ |
228 | 228 | public function keys() |
229 | 229 | { |
230 | - return array_keys((array)$this->array); |
|
230 | + return array_keys((array) $this->array); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function values() |
239 | 239 | { |
240 | - return array_values((array)$this->array); |
|
240 | + return array_values((array) $this->array); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //////////////////////////////////////////////////////////////////// |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function sort($sorter = null, $direction = 'asc') |
273 | 273 | { |
274 | - $array = (array)$this->array; |
|
274 | + $array = (array) $this->array; |
|
275 | 275 | |
276 | 276 | // Get correct PHP constant for direction |
277 | 277 | $direction = strtolower($direction); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $arrayy = new Arrayy($array); |
288 | 288 | |
289 | 289 | $results = $arrayy->each( |
290 | - function ($value) use ($sorter) { |
|
290 | + function($value) use ($sorter) { |
|
291 | 291 | return is_callable($sorter) ? $sorter($value) : $this->get($sorter, null, $value); |
292 | 292 | } |
293 | 293 | ); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function group($grouper, $saveKeys = false) |
313 | 313 | { |
314 | - $array = (array)$this->array; |
|
314 | + $array = (array) $this->array; |
|
315 | 315 | $result = array(); |
316 | 316 | |
317 | 317 | // Iterate over values, group by property/results from closure |