@@ -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,48 +151,48 @@ 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, |
|
189 | - function ($item) use ( |
|
188 | + (array) $this->array, |
|
189 | + function($item) use ( |
|
190 | 190 | $property, |
191 | 191 | $value, |
192 | 192 | $ops, |
193 | 193 | $comparisonOp |
194 | 194 | ) { |
195 | - $item = (array)$item; |
|
195 | + $item = (array) $item; |
|
196 | 196 | $itemArrayy = new Arrayy($item); |
197 | 197 | $item[$property] = $itemArrayy->get($property, array()); |
198 | 198 | |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function keys() |
233 | 233 | { |
234 | - $return = array_keys((array)$this->array); |
|
234 | + $return = array_keys((array) $this->array); |
|
235 | 235 | |
236 | 236 | return Arrayy::create($return); |
237 | 237 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function values() |
245 | 245 | { |
246 | - $return = array_values((array)$this->array); |
|
246 | + $return = array_values((array) $this->array); |
|
247 | 247 | |
248 | 248 | return Arrayy::create($return); |
249 | 249 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | public function sort($sorter = null, $direction = 'asc') |
281 | 281 | { |
282 | - $array = (array)$this->array; |
|
282 | + $array = (array) $this->array; |
|
283 | 283 | |
284 | 284 | // Get correct PHP constant for direction |
285 | 285 | $direction = strtolower($direction); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $arrayy = new Arrayy($array); |
296 | 296 | |
297 | 297 | $results = $arrayy->each( |
298 | - function ($value) use ($sorter) { |
|
298 | + function($value) use ($sorter) { |
|
299 | 299 | return is_callable($sorter) ? $sorter($value) : $this->get($sorter, null, $value); |
300 | 300 | } |
301 | 301 | ); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function group($grouper, $saveKeys = false) |
321 | 321 | { |
322 | - $array = (array)$this->array; |
|
322 | + $array = (array) $this->array; |
|
323 | 323 | $result = array(); |
324 | 324 | |
325 | 325 | // Iterate over values, group by property/results from closure |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | || |
30 | 30 | (is_object($array) && method_exists($array, '__toString')) |
31 | 31 | ) { |
32 | - $array = (array)$array; |
|
32 | + $array = (array) $array; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | if (!is_array($array)) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | - return (array)$this->array; |
|
179 | + return (array) $this->array; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // trim all string in the array |
227 | 227 | array_walk( |
228 | 228 | $array, |
229 | - function (&$val) { |
|
229 | + function(&$val) { |
|
230 | 230 | if (is_string($val)) { |
231 | 231 | $val = trim($val); |
232 | 232 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
277 | - return static::create((array)$return); |
|
277 | + return static::create((array) $return); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $return = array($key); |
295 | 295 | } |
296 | 296 | |
297 | - return static::create((array)$return); |
|
297 | + return static::create((array) $return); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | return false; |
351 | 351 | } |
352 | 352 | |
353 | - return (bool)count(array_filter(array_keys($this->array), 'is_string')); |
|
353 | + return (bool) count(array_filter(array_keys($this->array), 'is_string')); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -490,8 +490,8 @@ discard block |
||
490 | 490 | public function clean() |
491 | 491 | { |
492 | 492 | return $this->filter( |
493 | - function ($value) { |
|
494 | - return (bool)$value; |
|
493 | + function($value) { |
|
494 | + return (bool) $value; |
|
495 | 495 | } |
496 | 496 | ); |
497 | 497 | } |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | } |
511 | 511 | |
512 | 512 | if ($take === null) { |
513 | - return static::create((array)$this->array[array_rand($this->array)]); |
|
513 | + return static::create((array) $this->array[array_rand($this->array)]); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | shuffle($this->array); |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | $array = array_splice($this->array, 0, $take, true); |
586 | 586 | } |
587 | 587 | |
588 | - return static::create((array)$array); |
|
588 | + return static::create((array) $array); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | /** |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | public function last($take = null) |
599 | 599 | { |
600 | 600 | if ($take === null) { |
601 | - $array = static::create((array)array_pop($this->array)); |
|
601 | + $array = static::create((array) array_pop($this->array)); |
|
602 | 602 | } else { |
603 | 603 | $array = $this->rest(-$take); |
604 | 604 | } |
@@ -771,12 +771,12 @@ discard block |
||
771 | 771 | public function replaceValues($search, $replacement = '') |
772 | 772 | { |
773 | 773 | $array = $this->each( |
774 | - function ($value) use ($search, $replacement) { |
|
774 | + function($value) use ($search, $replacement) { |
|
775 | 775 | return UTF8::str_replace($search, $replacement, $value); |
776 | 776 | } |
777 | 777 | ); |
778 | 778 | |
779 | - return static::create((array)$array); |
|
779 | + return static::create((array) $array); |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | /** |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | { |
1091 | 1091 | $this->array = array_reduce( |
1092 | 1092 | $this->array, |
1093 | - function ($resultArray, $value) { |
|
1093 | + function($resultArray, $value) { |
|
1094 | 1094 | if (in_array($value, $resultArray, true) === false) { |
1095 | 1095 | $resultArray[] = $value; |
1096 | 1096 | } |